Multiple secondary transform matrices for video processing

ABSTRACT

A video processing method is provided to comprise: performing a conversion between a current video block of a video and a coded representation of the current video block, wherein the coded representation conforms to a format rule specifying that a syntax element corresponding to side information of a secondary transform tool for the current video block is signaled in the coded representation before transform related information, wherein the secondary transform tool includes applying, during encoding, a forward secondary transform to an output of a forward primary transform applied to a residual of a video block prior to quantization, or applying, during decoding, an inverse secondary transform to an output of dequantization of the video block before applying an inverse primary transform.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2020/089581, filed on May 11, 2020, which claims the priority toand benefit of International Patent Application No. PCT/CN2019/086420,filed on May 10, 2019. The entire disclosure of the aforementionedapplication is incorporated by reference as part of the disclosure ofthis application.

TECHNICAL FIELD

This patent document relates to video processing techniques, devices andsystems.

BACKGROUND

In spite of the advances in video compression, digital video stillaccounts for the largest bandwidth use on the internet and other digitalcommunication networks. As the number of connected user devices capableof receiving and displaying video increases, it is expected that thebandwidth demand for digital video usage will continue to grow.

SUMMARY

Devices, systems and methods related to digital video processing, andspecifically, to context modeling for residual coding in videoprocessing. The described methods may be applied to both the existingvideo coding standards (e.g., High Efficiency Video Coding (HEVC)) andfuture video coding standards or video codecs.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversation between a current video block of a video and a codedrepresentation of the video, wherein the conversion comprises:selecting, for the current video block of a video, a transform set or atransform matrix to be used in an application of a secondary transformtool to the current video block based on a characteristic of the currentvideo block; and applying the selected transform set or transform matrixto the current video block, and wherein, using the secondary transformtool: during encoding, a forward secondary transform is applied to anoutput of a forward primary transform applied to a residual of thecurrent video block prior to quantization, or during decoding, aninverse secondary transform is applied to an output of dequantization ofthe current video block before applying an inverse primary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the video, wherein the conversion comprises applying asecondary transform tool to a sub-region of the current video block thatis not a top-left part of the current video block, and wherein, usingthe secondary transform tool: during encoding, a forward secondarytransform is applied to an output of a forward primary transform appliedto a residual of the sub-region of the current video block prior toquantization, or during decoding, an inverse secondary transform isapplied to an output of dequantization of the sub-region of the currentvideo block before applying an inverse primary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes:determining, for a conversion between a current video block of a currentpicture of a video and a coded representation of the video, anapplicability of a secondary transform tool for the current video blockdue to a rule that is related to an intra prediction direction beingused for coding the current video block, a use of a coding tool, and/ora color component of the video that the current video block is from; andperforming the conversion based on the determining.

In another representative aspect, the disclosed technology may be usedto provide a method for video processing. This method includes:performing a conversion between a current video block of a video and acoded representation of the video, wherein the coded representationconforms to a format rule that specifies a last non-zero coefficient ina residual of the current video block and controls whether or how sideinformation about a secondary transform tool is included in the codedrepresentation, and wherein the secondary transform tool includesapplying, during encoding, a forward secondary transform to an output ofa forward primary transform applied to a residual of a video block priorto quantization, or applying, during decoding, an inverse secondarytransform to an output of dequantization of the video block beforeapplying an inverse primary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the video, wherein the coded representation conformsto a format rule that specifies one or more coefficients in a residualof a portion of the current video block and controls whether or how sideinformation about a secondary transform tool is included in the codedrepresentation, and wherein the secondary transform tool includesapplying, during encoding, a forward secondary transform to an output ofa forward primary transform applied to a residual of a video block priorto quantization, or applying, during decoding, an inverse secondarytransform to an output of dequantization to the video block beforeapplying an inverse primary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the video, wherein the performing of the conversionincludes determining an applicability of a secondary transform tool tothe current video block based on a presence of a non-zero coefficient inone or more coding groups of the current video block, and wherein thesecondary transform tool includes applying, during encoding, a forwardsecondary transform to an output of a forward primary transform appliedto a residual of a video block prior to quantization, or applying,during decoding, an inverse secondary transform to an output ofdequantization of the video block before applying an inverse primarytransform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the current video block, wherein the codedrepresentation conforms to a format rule specifying that a syntaxelement corresponding to side information of a secondary transform toolfor the current video block is signaled in the coded representationbefore transform related information, wherein the secondary transformtool includes applying, during encoding, a forward secondary transformto an output of a forward primary transform applied to a residual of avideo block prior to quantization, or applying, during decoding, aninverse secondary transform to an output of dequantization of the videoblock before applying an inverse primary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the video, wherein the coded representation conformsto a format rule specifying that a syntax element corresponding to sideinformation of a secondary transform tool for the current video block issignaled in the coded representation before residual coding information,wherein the secondary transform tool includes applying, during encoding,a forward secondary transform to an output of a forward primarytransform applied to a residual of a video block prior to quantization,or applying, during decoding, an inverse secondary transform to anoutput of dequantization to the video block before applying an inverseprimary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the video, wherein the performing of the conversionincludes coding a residual of the current video block according to arule based on information related to the secondary transform tool,wherein the secondary transform tool includes applying, during encoding,a forward secondary transform to an output of a forward primarytransform applied to a residual of a video block prior to quantization,or applying, during decoding, an inverse secondary transform to anoutput of dequantization to the video block before applying an inverseprimary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the video, wherein the performing of the conversionincludes applying, to one or more portions of the current video block,an arithmetic coding using different context modeling methods accordingto a rule.

In another representative aspect, the disclosed technology may be usedto provide a method for video processing. This method includesperforming a conversion between a current video block of a video and acoded representation of the video, wherein the performing of theconversion includes configuring, based on a characteristic of thecurrent video block of a video, a context model for coding a bin orbypass coding the bin of a bin string corresponding to an index of asecondary transform tool, wherein the index indicates an applicabilityof the secondary transform tool and/or a kernel information of thesecondary transform tool, and wherein the secondary transform toolincludes applying, during encoding, a forward secondary transform to anoutput of a forward primary transform applied to a residual of a videoblock prior to quantization, or wherein the secondary transform toolincludes applying, during decoding, an inverse secondary transform to anoutput of dequantization to the video block before applying an inverseprimary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the current video block, wherein the performing of theconversion includes determining, based on a dimension of the currentvideo block, whether a syntax element is included in the codedrepresentation, wherein the syntax element corresponds to sideinformation of a secondary transform tool which comprises at least oneof indication of applying the secondary transform and an index of thetransform kernels used in a secondary transform process, and wherein,using the secondary transform, an inverse secondary transform is usedfor decoding the coded representation and applied to an output ofdequantization of the current video block before applying an inverseprimary transform.

In one representative aspect, the disclosed technology may be used toprovide a method for video processing. This method includes: performinga conversion between a current video block of a video and a codedrepresentation of the current video block, wherein the performing of theconversion includes determining, based on a dimension of the currentvideo block, whether a syntax element is included in the codedrepresentation of the current video block, wherein the syntax elementcorresponds to side information of a secondary transform which comprisesat least one of indication of applying the secondary transform and anindex of the transform kernels used in a secondary transform process,and wherein, using the secondary transform, a forward secondarytransform that is used for encoding the current video block and appliedto an output of a primary transform of the current video block beforeapplying quantization process.

In yet another representative aspect, the above-described method isembodied in the form of processor-executable code and stored in acomputer-readable program medium.

In yet another representative aspect, a device that is configured oroperable to perform the above-described method is disclosed. The devicemay include a processor that is programmed to implement this method.

In yet another representative aspect, a video decoder apparatus mayimplement a method as described herein.

The above and other aspects and features of the disclosed technology aredescribed in greater detail in the drawings, the description and theclaims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a block diagram of an example encoder.

FIG. 2 shows an example of 67 intra prediction modes.

FIG. 3 shows an example of ALWIP for 4×4 blocks.

FIG. 4 shows an example of ALWIP for 8×8 blocks.

FIG. 5 shows an example of ALWIP for 8×4 blocks.

FIG. 6 shows an example of ALWIP for 16×16 blocks.

FIG. 7 shows an example of four reference lines neighboring a predictionblock.

FIG. 8 shows an example of divisions of 4×8 and 8×4 blocks.

FIG. 9 shows an example of divisions all blocks except 4×8, 8×4 and 4×4.

FIG. 10 shows an example of a secondary transform in JEM.

FIG. 11 shows an example of the proposed reduced secondary transform(RST).

FIG. 12 shows examples of the forward and inverse reduced transforms.

FIG. 13 shows an example of a forward RST 8×8 process with a 16×48matrix.

FIG. 14 shows an example of a zero-out region for an 8×8 matrix.

FIG. 15 shows an example of sub-block transform modes SBT-V and SBT-H.

FIG. 16 shows an example of a diagonal up-right scan order for a 4×4coding group.

FIG. 17 shows an example of a diagonal up-right scan order for an 8×8block with coding groups of size 4×4.

FIG. 18 shows an example of a template used to select probabilitymodels.

FIG. 19 shows an example of two scalar quantizers used for dependentquantization.

FIG. 20 shows an example of a state transition and quantizer selectionfor the proposed dependent quantization process.

FIG. 21 an example of an 8×8 block with 4 coding groups.

FIGS. 22A and 22B are block diagrams of examples of a hardware platformfor implementing a visual media decoding or a visual media encodingtechnique described in the present document.

FIGS. 23A and 23B show flowcharts of example methods for videoprocessing.

DETAILED DESCRIPTION

Embodiments of the disclosed technology may be applied to existing videocoding standards (e.g., HEVC, H.265) and future standards to improvecompression performance. Section headings are used in the presentdocument to improve readability of the description and do not in any waylimit the discussion or the embodiments (and/or implementations) to therespective sections only.

Video Coding Introduction

Due to the increasing demand of higher resolution video, video codingmethods and techniques are ubiquitous in modern technology. Video codecstypically include an electronic circuit or software that compresses ordecompresses digital video, and are continually being improved toprovide higher coding efficiency. A video codec converts uncompressedvideo to a compressed format or vice versa. There are complexrelationships between the video quality, the amount of data used torepresent the video (determined by the bit rate), the complexity of theencoding and decoding algorithms, sensitivity to data losses and errors,ease of editing, random access, and end-to-end delay (latency). Thecompressed format usually conforms to a standard video compressionspecification, e.g., the High Efficiency Video Coding (HEVC) standard(also known as H.265 or MPEG-H Part 2), the Versatile Video Codingstandard to be finalized, or other current and/or future video codingstandards.

Video coding standards have evolved primarily through the development ofthe well-known ITU-T and ISO/IEC standards. The ITU-T produced H.261 andH.263, ISO/IEC produced MPEG-1 and MPEG-4 Visual, and the twoorganizations jointly produced the H.262/MPEG-2 Video and H.264/MPEG-4Advanced Video Coding (AVC) and H.265/HEVC standards. Since H.262, thevideo coding standards are based on the hybrid video coding structurewherein temporal prediction plus transform coding are utilized. Toexplore the future video coding technologies beyond HEVC, Joint VideoExploration Team (JVET) was founded by VCEG and MPEG jointly in 2015.Since then, many new methods have been adopted by JVET and put into thereference software named Joint Exploration Model (JEM) [3][4]. In April2018, the Joint Video Expert Team (JVET) between VCEG (Q6/16) andISO/IEC JTC1 SC29/WG11 (MPEG) was created to work on the VVC standardtargeting at 50% bitrate reduction compared to HEVC.

2.1 Coding Flow of a Typical Video Codec

FIG. 1 shows an example of encoder block diagram of VVC, which containsthree in-loop filtering blocks: deblocking filter (DF), sample adaptiveoffset (SAO) and ALF. Unlike DF, which uses predefined filters, SAO andALF utilize the original samples of the current picture to reduce themean square errors between the original samples and the reconstructedsamples by adding an offset and by applying a finite impulse response(FIR) filter, respectively, with coded side information signaling theoffsets and filter coefficients. ALF is located at the last processingstage of each picture and can be regarded as a tool trying to catch andfix artifacts created by the previous stages.

2.2 Intra Coding in VVC

2.2.1 Intra Mode Coding with 67 Intra Prediction Modes

To capture the arbitrary edge directions presented in natural video, thenumber of directional intra modes is extended from 33, as used in HEVC,to 65. The additional directional modes are depicted as dotted arrows inFIG. 2, and the planar and DC modes remain the same. These denserdirectional intra prediction modes apply for all block sizes and forboth luma and chroma intra predictions.

Conventional angular intra prediction directions are defined from 45degrees to −135 degrees in clockwise direction as shown in FIG. 2. InVTM2, several conventional angular intra prediction modes are adaptivelyreplaced with wide-angle intra prediction modes for the non-squareblocks. The replaced modes are signaled using the original method andremapped to the indexes of wide angular modes after parsing. The totalnumber of intra prediction modes is unchanged, i.e., 67, and the intramode coding is unchanged.

In the HEVC, every intra-coded block has a square shape and the lengthof each of its side is a power of 2. Thus, no division operations arerequired to generate an intra-predictor using DC mode. In VVV2, blockscan have a rectangular shape that necessitates the use of a divisionoperation per block in the general case. To avoid division operationsfor DC prediction, only the longer side is used to compute the averagefor non-square blocks.

In addition to the 67 intra prediction modes, wide-angle intraprediction for non-square blocks (WAIP) and position dependent intraprediction combination (PDPC) methods are further enabled for certainblocks. PDPC is applied to the following intra modes without signalling:planar, DC, horizontal, vertical, bottom-left angular mode and its eightadjacent angular modes, and top-right angular mode and its eightadjacent angular modes.

2.2.2 Affine Linear Weighted Intra Prediction (ALWIP or Matrix-BasedIntra Prediction)

Affine linear weighted intra prediction (ALWIP, a.k.a. Matrix basedintra prediction (MIP)) is proposed in JVET-N0217.

2.2.2.1 Generation of the Reduced Prediction Signal by Matrix VectorMultiplication

The neighboring reference samples are firstly down-sampled via averagingto generate the reduced reference signal bdry_(red). Then, the reducedprediction signal pred_(red) is computed by calculating a matrix vectorproduct and adding an offset:

pred_(red) =A·bdry_(red) +b

Here, A is a matrix that has W_(red)·H_(red) rows and 4 columns if W=H=4and 8 columns in all other cases. b is a vector of size W_(red)·H_(red).

2.2.2.2 Illustration of the Entire ALWIP Process

The entire process of averaging, matrix vector multiplication and linearinterpolation is illustrated for different shapes in FIGS. 3-6. Note,that the remaining shapes are treated as in one of the depicted cases.

-   -   1. Given a 4×4 block, ALWIP takes two averages along each axis        of the boundary. The resulting four input samples enter the        matrix vector multiplication. The matrices are taken from the        set S₀. After adding an offset, this yields the 16 final        prediction samples. Linear interpolation is not necessary for        generating the prediction signal. Thus, a total of        (4·16)/(4·4)=4 multiplications per sample are performed.    -   2. Given an 8×8 block, ALWIP takes four averages along each axis        of the boundary. The resulting eight input samples enter the        matrix vector multiplication. The matrices are taken from the        set S₁. This yields 16 samples on the odd positions of the        prediction block. Thus, a total of (8·16)/(8·8)=2        multiplications per sample are performed. After adding an        offset, these samples are interpolated vertically by using the        reduced top boundary. Horizontal interpolation follows by using        the original left boundary.    -   3. Given an 8×4 block, ALWIP takes four averages along the        horizontal axis of the boundary and the four original boundary        values on the left boundary. The resulting eight input samples        enter the matrix vector multiplication. The matrices are taken        from the set S₁. This yields 16 samples on the odd horizontal        and each vertical positions of the prediction block. Thus, a        total of (8·16)/(8·4)=4 multiplications per sample are        performed. After adding an offset, these samples are        interpolated horizontally by using the original left boundary.    -   4. Given a 16×16 block, ALWIP takes four averages along each        axis of the boundary. The resulting eight input samples enter        the matrix vector multiplication. The matrices are taken from        the set S₂. This yields 64 samples on the odd positions of the        prediction block. Thus, a total of (8·64)/(16·16)=2        multiplications per sample are performed. After adding an        offset, these samples are interpolated vertically by using eight        averages of the top boundary. Horizontal interpolation follows        by using the original left boundary. The interpolation process,        in this case, does not add any multiplications. Therefore,        totally, two multiplications per sample are required to        calculate ALWIP prediction.

For larger shapes, the procedure is essentially the same and it is easyto check that the number of multiplications per sample is less thanfour.

For W×8 blocks with W>8, only horizontal interpolation is necessary asthe samples are given at the odd horizontal and each vertical positions.

Finally, for W×4 blocks with W>8, let A_kbe the matrix that arises byleaving out every row that corresponds to an odd entry along thehorizontal axis of the downsampled block. Thus, the output size is 32and again, only horizontal interpolation remains to be performed.

The transposed cases are treated accordingly.

2.2.2.3 Syntax and Semantics

7.3.6.5 Coding Unit Syntax

coding_unit( x0, y0, cbWidth, cbHeight, treeType ) { Descriptor  if(tile_group_type != I | | sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA )    cu_skip_flag[ x0 ][ y0 ] ae(v)   if( cu_skip_flag[x0 ][ y0 ] = = 0 && tile_group_type != I )    pred_mode_flag ae(v)   if(( ( tile_group_type = = I && cu_skip_flag[ x0 ][ y0 ] = = 0 ) | |    (tile_group_type != I && CuPredMode[ x0 ][ y0 ] != MODE_INTRA ) ) &&   sps_ibc_enabled_flag )    pred_mode_ibc_flag ae(v)  }  if(CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {   if( sps_pcm_enabled_flag &&   cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY &&   cbHeight >= MinIpcmCbSizeY && cbHeight <= MaxIpcmCbSizeY )   pcm_flag[ x0 ][ y0 ] ae(v)   if( pcm_flag[ x0 ][ y0 ] ) {    while(!byte_aligned( ) )     pcm_alignment_zero_bit f(1)    pcm_sample(cbWidth, cbHeight, treeType)   } else {    if( treeType = = SINGLE_TREE| | treeType = = DUAL_TREE_LUMA ) {     if( abs( Log2( cbWidth ) − Log2(cbHeight ) ) <= 2 )      intra_lwip_flag[ x0 ][ y0 ] ae(v)     if(intra_lwip_flag[ x0 ][ y0 ] ) {       intra_lwip_mpm_flag[ x0 ][ y0 ]ae(v)      if( intra_lwip_mpm_flag[ x0 ][ y0 ] )      intra_lwip_mpm_idx[ x0 ][ y0 ] ae(v)      else      intra_lwip_mpm_remainder[ x0 ][ y0 ] ae(v)     } else {      if( (y0 % CtbSizeY ) > 0 )       intra_luma_ref_idx[ x0 ][ y0 ] ae(v)      if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 &&       ( cbWidth <= MaxTbSizeY || cbHeight <= MaxTbSizeY ) &&       ( cbWidth * cbHeight > MinTbSizeY *MinTbSizeY ))       intra_subpartitions_mode_flag[ x0 ][ y0 ] ae(v)     if( intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 &&      cbWidth <= MaxTbSizeY && cbHeight <= MaxTbSizeY )      intra_subpartitions_split_flag[ x0 ][ y0 ] ae(v)      if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 &&      intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 0 )      intra_luma_mpm_flag[ x0 ][ y0 ] ae(v)      if(intra_luma_mpm_flag[ x0 ][ y0 ] )       intra_luma_mpm_idx[ x0 ][ y0 ]ae(v)      else       intra_luma_mpm_remainder[ x0 ][ y0 ] ae(v)     }   }    if( treeType = = SINGLE_TREE | | treeType = = DUAL_TREE_CHROMA )    intra_chroma_pred_mode[ x0 ][ y0 ] ae(v)   }  } else if( treeType !=DUAL_TREE_CHROMA ) { /* MODE_INTER or MODE_IBC */ . . .  } }

2.2.3 Multiple Reference Line (MRL)

Multiple reference line (MRL) intra prediction uses more reference linesfor intra prediction. In FIG. 7, an example of 4 reference lines isdepicted, where the samples of segments A and F are not fetched fromreconstructed neighbouring samples but padded with the closest samplesfrom Segment B and E, respectively. HEVC intra-picture prediction usesthe nearest reference line (i.e., reference line 0). In MRL, 2additional lines (reference line 1 and reference line 3) are used.

The index of selected reference line (mrl_idx) is signaled and used togenerate intra predictor. For reference line index, which is greaterthan 0, only include additional reference line modes in MPM list andonly signal MPM index without remaining mode. The reference line indexis signaled before intra prediction modes, and Planar and DC modes areexcluded from intra prediction modes in case a nonzero reference lineindex is signaled.

MRL is disabled for the first line of blocks inside a CTU to preventusing extended reference samples outside the current CTU line. Also,PDPC is disabled when additional line is used.

2.2.4 Intra Sub-Block Partitioning (ISP)

In JVET-M0102, ISP is proposed, which divides luma intra-predictedblocks vertically or horizontally into 2 or 4 sub-partitions dependingon the block size dimensions, as shown in Table 1. FIG. 8 and FIG. 9show examples of the two possibilities. All sub-partitions fulfill thecondition of having at least 16 samples. For block sizes, 4×N or N×4(with N>8), if allowed, the 1×N or N×1 sub-partition may exist.

TABLE 1 Number of sub-partitions depending on the block size (denotedmaximum transform size by maxTBSize) Number Splitting of Sub- directionBlock Size Partitions N/A minimum transform size Not divided 4 x 8:horizontal 4 x 8 and 8 x 4 2 8 x 4: vertical Signaled If neither 4 x 8nor 8 x 4, 4 and W <= maxTBSize and H <= maxTBSize Horizontal If notabove cases and 4 H > maxTBSize Vertical If not above cases and 4 H >maxTBSize

For each of these sub-partitions, a residual signal is generated byentropy decoding the coefficients sent by the encoder and then invertquantizing and invert transforming them. Then, the sub-partition isintra predicted and finally the corresponding reconstructed samples areobtained by adding the residual signal to the prediction signal.Therefore, the reconstructed values of each sub-partition will beavailable to generate the prediction of the next one, which will repeatthe process and so on. All sub-partitions share the same intra mode.

TABLE 2 Specification of trTypeHor and trTypeVer depending onpredModeIntra predModeIntra trTypeHor trTypeVer INTRA_PLANAR, ( nTbW >=4 && ( nTbH >= 4 && INTRA_ANGULAR31, nTbW <= 16 ) ? nTbH <= 16 ) ?INTRA_ANGULAR32, DST-VII : DST-VII : INTRA_ANGULAR34, DCT-II DCT-IIINTRA_ANGULAR36, INTRA_ANGULAR37 INTRA_ANGULAR33, DCT-II DCT-IIINTRA_ANGULAR35 INTRA_ANGULAR2, ( nTbW >= 4 && DCT-II INTRA_ANGULAR4, .. . , nTbW <= 16 ) ? INTRA_ANGULAR28, DST-VII : DCT-II INTRA_ANGULAR30,INTRA_ANGULAR39, INTRA_ANGULAR41, . . . , INTRA_ANGULAR63,INTRA_ANGULAR65 INTRA_ANGULAR3, DCT-II ( nTbH >= 4 && INTRA_ANGULAR5, .. . , nTbH <= 16 ) ? INTRA_ANGULAR27, DST-VII : INTRA_ANGULAR29, DCT-IIINTRA_ANGULAR38, INTRA_ANGULAR40, . . . , INTRA_ANGULAR64,INTRA_ANGULAR66

2.2.4.1 Syntax and Semantics

7.3.7.5 Coding Unit Syntax

coding_unit( x0, y0, cbWidth, cbHeight, treeType ) { Descriptor  if(slice_type != I | | sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA )    cu_skip_flag[ x0 ][ y0 ] ae(v)   if( cu_skip_flag[x0 ][ y0 ] = = 0 && slice_type != I )    pred_mode_flag ae(v)   if( ( (slice_type = = I && cu_skip_flag[ x0 ][ y0 ] = = 0 ) | |    ( slice_type!= I && CuPredMode[ x0 ][ y0 ] != MODE_INTRA ) ) &&   sps_ibc_enabled_flag )    pred_mode_ibc_flag ae(v)  }  if(CuPredMode[ x0 ][ y0 ] = = MODE_INTRA ) {   if( sps_pcm_enabled_flag &&   cbWidth >= MinIpcmCbSizeY && cbWidth <= MaxIpcmCbSizeY &&   cbHeight >= MinIpcmCbSizeY && cbHeight <= MaxIpcmCbSizeY )   pcm_flag[ x0 ][ y0 ] ae(v)   if( pcm_flag[ x0 ][ y0 ] ) {    while(!byte_aligned( ) )     pcm_alignment_zero_bit f(1)    pcm_sample(cbWidth, cbHeight, treeType)   } else {    if( treeType = = SINGLE_TREE| | treeType = = DUAL_TREE_LUMA ) {     if( ( y0 % CtbSizeY ) > 0 )     intra_luma_ref_idx[ x0 ][ y0 ] ae(v)     if (intra_luma_ref idx[ x0][ y0 ] = = 0 &&      ( cbWidth <= MaxTbSizeY | | cbHeight <= MaxTbSizeY) &&      ( cbWidth * cbHeight >MinTbSizeY * MinTbSizeY ))     intra_subpartitions_mode_flag[ x0 ][ y0 ] ae(v)     if(intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 1 &&      cbWidth <=MaxTbSizeY && cbHeight <= MaxTbSizeY )     intra_subpartitions_split_flag[ x0 ][ y0 ] ae(v)     if(intra_luma_ref_idx[ x0 ][ y0 ] = = 0 &&     intra_subpartitions_mode_flag[ x0 ][ y0 ] = = 0 )     intra_luma_mpm_flag[ x0 ][ y0 ] ae(v)     if( intra_luma_mpm_flag[x0 ][ y0 ] )      intra_luma_mpm_idx[ x0 ][ y0 ] ae(v)     else     intra_luma_mpm_remainder[ x0 ][ y0 ] ae(v)    }    if( treeType = =SINGLE_TREE | | treeType = = DUAL_TREE_CHROMA )    intra_chroma_pred_mode[ x0 ][ y0 ] ae(v)   }  } else if( treeType !=DUAL_TREE_CHROMA ) { /* MODE_INTER or MODE_IBC */ . . .  } . . . }intra_subpartitions_mode_flag[x0][y0] equal to 1 specifies that thecurrent intra coding unit is partitioned intoNumIntraSubPartitions[x0][y0] rectangular transform block subpartitions.intra_subpartitions_mode_flag[x0][y0] equal to 0 specifies that thecurrent intra coding unit is not partitioned into rectangular transformblock subpartitions.When intra_subpartitions_mode_flag[x0][y0] is not present, it isinferred to be equal to 0.intra_subpartitions_split_flag[x0][y0] specifies whether the intrasubpartitions split type is horizontal or vertical.When intra_subpartitions_split_flag[x0][y0] is not present, it isinferred as follows:

-   -   If cbHeight is greater than MaxTbSizeY,        intra_subpartitions_split_flag[x0][y0] is inferred to be equal        to 0.    -   Otherwise (cbWidth is greater than MaxTbSizeY),        intra_subpartitions_split_flag[x0][y0] is inferred to be equal        to 1.        The variable IntraSubPartitionsSplitType specifies the type of        split used for the current luma coding block as illustrated in        Table 7-9. IntraSubPartitionsSplitType is derived as follows:    -   If intra_subpartitions_mode_flag[x0][y0] is equal to 0,        IntraSubPartitionsSplitType is set equal to 0.    -   Otherwise, the IntraSubPartitionsSplitType is set equal to        1+intra_subpartitions_split_flag[x0][y0].

TABLE 7-9 Name association to IntraSubPartitionsSplitTypeIntraSubPartitionsSplitType Name of IntraSubPartitionsSplitType 0ISP_NO_SPLIT 1 ISP_HOR_SPLIT 2 ISP_VER_SPLITThe variable NumIntraSubPartitions specifies the number of transformblock subpartitions an intra luma coding block is divided into.NumIntraSubPartitions is derived as follows:

-   -   If IntraSubPartitionsSplitType is equal to ISP_NO_SPLIT,        NumIntraSubPartitions is set equal to 1.    -   Otherwise, if one of the following conditions is true,        NumIntraSubPartitions is set equal to 2:        -   cbWidth is equal to 4 and cbHeight is equal to 8,        -   cbWidth is equal to 8 and cbHeight is equal to 4.    -   Otherwise, NumIntraSubPartitions is set equal to 4.

2.3 Chroma Intra Mode Coding

For chroma intra mode coding, a total of 8 or 5 intra modes are allowedfor chroma intra mode coding depending on whether cross-component linearmodel (CCLM) is enabled or not. Those modes include five traditionalintra modes and three cross-component linear model modes. Chroma DM modeuse the corresponding luma intra prediction mode. Since separate blockpartitioning structure for luma and chroma components is enabled in Islices, one chroma block may correspond to multiple luma blocks.Therefore, for Chroma DM mode, the intra prediction mode of thecorresponding luma block covering the center position of the currentchroma block is directly inherited.

TABLE 8-2 Specification of IntraPredModeC[ xCb ][ yCb ] depending onintra_chroma_pred_mode [ xCb ][ yCb ] and IntraPredModeY [ xCb + cbWidth/ 2 ][ yCb + cbHeight / 2 ] when sps_cclm_enabled_flag is equal to 0IntraPredModeY intra_chroma_ [xCb + cbWidth / 2 ] pred_mode [yCb +cbHeight / 2 ] [ xCb ][ yCb ] 0 50 18 1 X ( 0 <= X <= 66 ) 0 66 0 0 0 01 50 66 50 50 50 2 18 18 66 18 18 3 1 1 1 66 1 4 (DM) 0 50 18 1 X

TABLE 8-3 Specification of IntraPredModeC[ xCb ][ yCb ] depending onintra_chroma_pred_mode [ xCb ][ yCb ] and IntraPredModeY [ xCb + cbWidth/ 2 ][ yCb + cbHeight / 2 ] when sps_cclm_enabled_flag is equal to 1IntraPredModeY intra_chroma_ [ xCb + cbWidth / 2 ] pred_mode [ yCb +cbHeight / 2 ] [ xCb ][ yCb ] 0 50 18 1 X ( 0 <= X <= 66 ) 0 66 0 0 0 01 50 66 50 50 50 2 18 18 66 18 18 3 1 1 1 66 1 4 81 81 81 81 81 5 82 8282 82 82 6 83 83 83 83 83 7 (DM) 0 50 18 1 X

2.4 Transform Coding in VVC

2.4.1 Multiple Transform Set (MTS) in VVC

2.4.1.1 Explicit Multiple Transform Set (MTS)

In VTM4, large block-size transforms, up to 64×64 in size, are enabled,which is primarily useful for higher resolution video, e.g., 1080p and4K sequences. High frequency transform coefficients are zeroed out forthe transform blocks with size (width or height, or both width andheight) equal to 64, so that only the lower-frequency coefficients areretained. For example, for an M×N transform block, with M as the blockwidth and N as the block height, when M is equal to 64, only the left 32columns of transform coefficients are kept. Similarly, when N is equalto 64, only the top 32 rows of transform coefficients are kept. Whentransform skip mode is used for a large block, the entire block is usedwithout zeroing out any values.

In addition to DCT-II which has been employed in HEVC, a MultipleTransform Selection (MTS) scheme is used for residual coding both interand intra coded blocks. It uses multiple selected transforms from theDCT8/DST7. The newly introduced transform matrices are DST-VII andDCT-VIII. The Table 4 below shows the basis functions of the selectedDST/DCT.

TABLE 4 Basis functions of transform matrices used in VVC Transform TypeBasis function T_(i)(j), i, j = 0, 1, . . . , N − 1 DCT-II${T_{i}(j)} = {\omega_{0} \cdot \sqrt{\frac{2}{N}} \cdot {\cos\left( \frac{\pi \cdot i \cdot \left( {{2j} + 1} \right)}{2N} \right)}}$${{where}\mspace{14mu}\omega_{0}} = \left\{ \begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix} \right.$ DCT-VIII${T_{i}(j)} = {\sqrt{\frac{4}{{2N} + 1}} \cdot {\cos\left( \frac{\pi \cdot \left( {{2i} + 1} \right) \cdot \left( {{2j} + 1} \right)}{{4N} + 2} \right)}}$DST-VII${T_{i}(j)} = {\sqrt{\frac{4}{{2N} + 1}} \cdot {\sin\left( \frac{\pi \cdot \left( {{2i} + 1} \right) \cdot \left( {j + 1} \right)}{{2N} + 1} \right)}}$

In order to keep the orthogonality of the transform matrix, thetransform matrices are quantized more accurately than the transformmatrices in HEVC. To keep the intermediate values of the transformedcoefficients within the 16-bit range, after horizontal and aftervertical transform, all the coefficients are to have 10-bit.

In order to control MTS scheme, separate enabling flags are specified atSPS level for intra and inter, respectively. When MTS is enabled at SPS,a CU level flag is signaled to indicate whether MTS is applied or not.Here, MTS is applied only for luma. The MTS CU level flag is signaledwhen the following conditions are satisfied.

-   -   Both width and height smaller than or equal to 32    -   CBF flag is equal to one

If MTS CU flag is equal to zero, then DCT2 is applied in bothdirections. However, if MTS CU flag is equal to one, then two otherflags are additionally signaled to indicate the transform type for thehorizontal and vertical directions, respectively. Transform andsignaling mapping table as shown in Table 5. When it comes to transformmatrix precision, 8-bit primary transform cores are used. Therefore, allthe transform cores used in HEVC are kept as the same, including 4-pointDCT-2 and DST-7, 8-point, 16-point and 32-point DCT-2. Also, othertransform cores including 64-point DCT-2, 4-point DCT-8, 8-point,16-point, 32-point DST-7 and DCT-8, use 8-bit primary transform cores.

TABLE 5 Mapping of decoded value of tu_mts_idx and correspondingtransform matrices for the horizontal and vertical directions. Binstring of Intra/inter tu_mts_idx tu_mts_idx Horizontal Vertical 0 0 DCT21 0 1 DST7 DST7 1 1 0 2 DCT8 DST7 1 1 1 0 3 DST7 DCT8 1 1 1 1 4 DCT8DCT8

To reduce the complexity of large size DST-7 and DCT-8, High frequencytransform coefficients are zeroed out for the DST-7 and DCT-8 blockswith size (width or height, or both width and height) equal to 32. Onlythe coefficients within the 16×16 lower-frequency region are retained.

In addition to the cases wherein different transforms are applied, VVCalso supports a mode called transform skip (TS) which is like theconcept of TS in the HEVC. TS is treated as a special case of MTS.

2.4.2 Reduced Secondary Transform (RST) Proposed in JVET-N0193

2.4.2.1 Non-Separable Secondary Transform (NSST) in JEM

In JEM, secondary transform is applied between forward primary transformand quantization (at encoder) and between de-quantization and invertprimary transform (at decoder side). As shown in FIG. 10, 4×4 (or 8×8)secondary transform is performed depends on block size. For example, 4×4secondary transform is applied for small blocks (i.e., min (width,height)<8) and 8×8 secondary transform is applied for larger blocks(i.e., min (width, height)>4) per 8×8 block.

Application of a non-separable transform is described as follows usinginput as an example. To apply the non-separable transform, the 4×4 inputblock X

$X = \begin{bmatrix}X_{00} & X_{01} & X_{02} & X_{03} \\X_{10} & X_{11} & X_{12} & X_{13} \\X_{20} & X_{21} & X_{22} & X_{23} \\X_{30} & X_{31} & X_{32} & X_{33}\end{bmatrix}$

is first represented as a vector {right arrow over (X)}:

{right arrow over (X)}=[X₀₀ X₀₁ X₀₂ X₀₃ X₁₀ X₁₁ X₁₂ X₁₃ X₂₀ X₂₁ X₂₂ X₂₃X₃₀ X₃₁ X₃₂ X₃₃]^(T)

The non-separable transform is calculated as {right arrow over (F)}=T·X,where {right arrow over (F)} indicates the transform coefficient vector,and T is a 16×16 transform matrix. The 16×1 coefficient vector F issubsequently re-organized as 4×4 block using the scanning order for thatblock (horizontal, vertical or diagonal). The coefficients with smallerindex will be placed with the smaller scanning index in the 4×4coefficient block. There are totally 35 transform sets and 3non-separable transform matrices (kernels) per transform set are used.The mapping from the intra prediction mode to the transform set ispre-defined. For each transform set, the selected non-separablesecondary transform (NSST) candidate is further specified by theexplicitly signalled secondary transform index. The index is signalledin a bit-stream once per Intra CU after transform coefficients.

2.4.2.2 Reduced Secondary Transform (RST) in JVET-N0193

The RST (a.k.a. Low Frequency Non-Separable Transform (LFNST)) wasintroduced in JVET-K0099 and 4 transform set (instead of 35 transformsets) mapping introduced in JVET-L0133. In this JVET-N0193, 16×64(further reduced to 16×48) and 16×16 matrices are employed. Fornotational convenience, the 16×64 (reduced to 16×48) transform isdenoted as RST8×8 and the 16×16 one as RST4×4. FIG. 11 shows an exampleof RST.

2.4.2.2.1 RST Computation

The main idea of a Reduced Transform (RT) is to map an N dimensionalvector to an R dimensional vector in a different space, where R/N (R<N)is the reduction factor.

The RT matrix is an R×N matrix as follows:

$T_{R \times N} = \begin{bmatrix}t_{11} & t_{12} & t_{13} & \ldots & t_{1N} \\t_{21} & t_{22} & t_{23} & \; & t_{2N} \\\; & \vdots & \; & \ddots & \vdots \\t_{R\; 1} & t_{R\; 2} & t_{R\; 3} & \ldots & t_{\;^{RN}}\end{bmatrix}$

where the R rows of the transform are R bases of the N dimensionalspace. The invert transform matrix for RT is the transpose of itsforward transform. The forward and invert RT are depicted in FIG. 12.

In this contribution, the RST8×8 with a reduction factor of 4 (¼ size)is applied. Hence, instead of 64×64, which is conventional 8×8non-separable transform matrix size, 16×64 direct matrix is used. Inother words, the 64×16 invert RST matrix is used at the decoder side togenerate core (primary) transform coefficients in 8×8 top-left regions.The forward RST8×8 uses 16×64 (or 8×64 for 8×8 block) matrices so thatit produces non-zero coefficients only in the top-left 4×4 region withinthe given 8×8 region. In other words, if RST is applied then the 8×8region except the top-left 4×4 region will have only zero coefficients.For RST4×4, 16×16 (or 8×16 for 4×4 block) direct matrix multiplicationis applied.

An invert RST is conditionally applied when the following two conditionsare satisfied:

-   -   Block size is greater than or equal to the given threshold (W>=4        && H>=4)    -   Transform skip mode flag is equal to zero

If both width (W) and height (H) of a transform coefficient block isgreater than 4, then the RST8×8 is applied to the top-left 8×8 region ofthe transform coefficient block. Otherwise, the RST4×4 is applied on thetop-left min(8, W)×min(8, H) region of the transform coefficient block.

If RST index is equal to 0, RST is not applied. Otherwise, RST isapplied, of which kernel is chosen with the RST index. The RST selectionmethod and coding of the RST index are explained later.

Furthermore, RST is applied for intra CU in both intra and inter slices,and for both Luma and Chroma. If a dual tree is enabled, RST indices forLuma and Chroma are signaled separately. For inter slice (the dual treeis disabled), a single RST index is signaled and used for both Luma andChroma.

2.4.2.2.2 Restriction of RST

When ISP mode is selected, RST is disabled, and RST index is notsignaled, because performance improvement was marginal even if RST isapplied to every feasible partition block. Furthermore, disabling RSTfor ISP-predicted residual could reduce encoding complexity.

2.4.2.2.3 RST Selection

A RST matrix is chosen from four transform sets, each of which consistsof two transforms. Which transform set is applied is determined fromintra prediction mode as the following:

-   -   (1) If one of three CCLM modes is indicated, transform set 0 is        selected.    -   (2) Otherwise, transform set selection is performed according to        the following table:

The transform set selection table Tr. set IntraPredMode indexIntraPredMode < 0 1 0 <= IntraPredMode <= 1 0 2 <= IntraPredMode <= 12 113 <= IntraPredMode <= 23 2 24 <= IntraPredMode <= 44 3 45 <=IntraPredMode <= 55 2 56 <= IntraPredMode 1

The index to access the above table, denoted as IntraPredMode, have arange of [−14, 83], which is a transformed mode index used for wideangle intra prediction.

2.4.2.2.4 RST Matrices of Reduced Dimension

As a further simplification, 16×48 matrices are applied instead of 16×64with the same transform set configuration, each of which takes 48 inputdata from three 4×4 blocks in a top-left 8×8 block excludingright-bottom 4×4 block (as shown in FIG. 13).

2.4.2.2.5 RST Signaling

The forward RST8×8 uses 16×48 matrices so that it produces non-zerocoefficients only in the top-left 4×4 region within the first 34×4region. In other words, if RST8×8 is applied, only the top-left 4×4 (dueto RST8×8) and bottom right 4×4 region (due to primary transform) mayhave non-zero coefficients. As a result, RST index is not coded when anynon-zero element is detected within the top-right 4×4 and bottom-left4×4 block region (shown in FIG. 14, and referred to as “zero-out”regions) because it implies that RST was not applied. In such a case,RST index is inferred to be zero.

2.4.2.2.6 Zero-Out Region within One CG

Usually, before applying the invert RST on a 4×4 sub-block, anycoefficient in the 4×4 sub-block may be non-zero. However, it isconstrained that in some cases, some coefficients in the 4×4 sub-blockmust be zero before invert RST is applied on the sub-block.

Let nonZeroSize be a variable. It is required that any coefficient withthe index no smaller than nonZeroSize when it is rearranged into a 1-Darray before the invert RST must be zero.

When nonZeroSize is equal to 16, there is no zero-out constrain on thecoefficients in the top-left 4×4 sub-block.

In JVET-N0193, when the current block size is 4×4 or 8×8, nonZeroSize isset equal to 8 (that is, coefficients with the scanning index in therange [8, 15] as show in FIG. 14, shall be 0). For other blockdimensions, nonZeroSize is set equal to 16.

2.4.2.2.7 Description of RST in Working Draft

7.3.2.3 Sequence Parameter Set RBSP Syntax

Descriptor seq_parameter_set_rbsp( ) {  ......  sps_mts_enabled_flagu(1)  if( sps_mts_enabled_flag ) {   sps_explicit_mts_intra_enabled_flagu(1)   sps_explicit_mts_inter_enabled_flag u(1)  }  ... sps_st_enabled_flag u(1)  ... }

7.3.7.11 Residual Coding Syntax

Descriptor residual_coding( x0, y0, log2TbWidth, log2TbHeight, cIdx ) {...  if( coded_sub_block_flag[ xS ][ yS ] && ( n > 0 | |!inferSbDcSigCoeffFlag ) &&   ( xC != LastSignificantCoeffX | | yC !=Last SignificantCoeffY ) ) {   sig_coeff_flag[ xC ][ yC ] ae(v)  remBinsPass1− −   if( sig_coeff_flag[ xC ][ yC ] )   inferSbDcSigCoeffFlag = 0  }  if( sig_coeff_flag[ xC ][ yC ] ) {  if( !transform_skip_flag[ x0 ][ y0 ] ) {   numSigCoeff++    if( ( ( (log2TbWidth == 2 && log2TbHeight == 2 ) | | ( log2TbWidth == 3 &&log2TbHeight == 3 ) ) && n >= 8 && i == 0 ) | | ( ( log2TbWidth >= 3 &&log2TbHeight >= 3 && ( i == 1 | | i == 2 ) ) ) ) {     numZeroOutSigCoeff++    }   }   abs_level_gt1_flag[ n ] ae(v) ...

7.3.7.5 Coding Unit Syntax

Descriptor coding_unit( x0, y0, cbWidth, cbHeight, treeType ) { ...  if(!pcm_flag[ x0 ][ y0 ] ) {   if( CuPredMode[ x0 ][ y0 ] != MODE_INTRA &&merge_flag[ x0 ][ y0 ] = = 0 )    cu_cbf ae(v)   if( cu_cbf ) {    if(CuPredMode[ x0 ][ y0 ] = = MODE_INTER && sps_sbt_enabled_flag &&    !ciip_flag[ x0 ][ y0 ] ) {     if( cbWidth <= MaxSbtSize && cbHeight<= MaxSbtSize ) {      allowSbtVerH = cbWidth >= 8      allowSbtVerQ =cbWidth >= 16      allowSbtHorH = cbHeight >= 8      allowSbtHorQ =cbHeight >= 16      if( allowSbtVerH | | allowSbtHorH | | allowSbtVerQ ||      allowSbtHorQ )       cu_sbt_flag ae(v)     }     if( cu_sbt_flag) {      if( ( allowSbtVerH | | allowSbtHorH ) && ( allowSbtVerQ | |allowSbtHorQ) )       cu_sbt_quad_flag ae(v)      if( ( cu_sbt_quad_flag&& allowSbtVerQ && allowSbtHorQ ) | |       ( !cu_sbt_quad_flag &&allowSbtVerH && allowSbtHorH ) )              cu_sbt_horizontal_flagae(v)      cu_sbt_pos_flag ae(v)    }   }   numZeroOutSigCoeff = 0  transform_tree( x0, y0, cbWidth, cbHeight, treeType )   if( Min(cbWidth, cbHeight ) >= 4 && sps_st_enabled_flag == 1 && CuPredMode [ x0][ y0 ] = = MODE_INTRA && IntraSubPartitionsSplitType == ISP_NO_SPLIT ){     if( ( numSigCoeff > ( ( treeType == SINGLE_TREE ) ? 2 : 1 ) ) &&numZeroOutSigCoeff == 0 ) {      st_idx[ x0 ][ y0 ] ae(v)     }    }   } } }sps_st_enabled_flag equal to 1 specifies that st_idx may be present inthe residual coding syntax for intra coding units. sps_st_enabled_flagequal to 0 specifies that st_idx is not present in the residual codingsyntax for intra coding units.st_idx[×0][y0] specifies which secondary transform kernel is appliedbetween two candidate kernels in a selected transform set.st_idx[×0][y0] equal to 0 specifies that the secondary transform is notapplied. The array indices×0, y0 specify the location (×0, y0) of thetop-left sample of the considered transform block relative to thetop-left sample of the picture.When st_idx[×0][y0] is not present, st_idx[×0][y0] is inferred to beequal to 0.Bins of st_idx are context-coded. More specifically, the followingapplies:

TABLE 9-9 Syntax elements and associated binarizations SyntaxBinarization structure Syntax element Process Input parameters ............. ...... st_idx[ ][ ] TR cMax = 2, cRiceParam = 0

TABLE 9-15 Assignment of ctxInc to syntax elements with context codedbins binIdx Syntax element 0 1 2 3 4 >= 5 . . . . . . . . . . . . . . .. . . . . . st_idx[ ][ ] 0, 1, 4, 5 2, 3, 6, 7 na na na na (clause9.5.4.2.8) (clause 9.5.4.2.8) . . . . . . . . . . . . . . . . . . . . .

9.5.4.2.8 Derivation Process of ctxInc for the Syntax Element st_idx

Inputs to this process are the colour component index cIdx, the luma orchroma location (×0, y0) specifying the top-left sample of the currentluma or chroma coding block relative to the top-left sample of thecurrent picture depending on cIdx, the tree type treeType, the lumaintra prediction mode IntraPredModeY[×0][y0] as specified in clause8.4.2, the syntax element intra_chroma_pred_mode[×0][y0] specifying theintra prediction mode for chroma samples as specified in clause 7.4.7.5,and the multiple transform selection index tu_mts_idx[×0][y0].Output of this process is the variable ctxInc.The variable intraModeCtx is derived as follows:If cIdx is equal to 0, intraModeCtx is derived as follows:

intraModeCtx=(IntraPredModeY[×0][y0]<=1)?1:0

Otherwise (cIdx is greater than 0), intraModeCtx is derived as follows:

intraModeCtx=(intra_chroma_pred_mode[×0][y0]>=4)?1:0

The variable mtsCtx is derived as follows:

mtsCtx=(tu_mts_idx[×0][y0]==0&& treeType!=SINGLE_TREE)?1:0

The variable ctxInc is derived as follows:

ctxInc=(binIdx<<1)+intraModeCtx+(mtsCtx<<2)

2.4.2.2.8 Summary of RST Usage

RST may be enabled only when the number of non-zero coefficients in oneblock is greater than 2 and 1 for single and separate tree,respectively. In addition, the following restrictions of locations ofnon-zero coefficients for RST applied Coding Groups (CGs) is alsorequired when RST is enabled.

TABLE 1 Usage of RST Block size RST type # of CGs that RST Which CG thatPotential locations applied to RST applied to of non-zero coeffs mayhave non- in the CGs RST zero coeffs applied to (nonZeroSize relative toone CG) 4 × 4 RST4 × 4 1 (Top-left 4 × 4) Top-left 4 × 4 First 8 indiagonal (16 × 16) scan order (0..7 in FIG. 16, nonZeroSize = 8 4 × 8/8× 4 RST4 × 4 1 (Top-left 4 × 4) Top-left 4 × 4 all, nonZeroSize = (16 ×16) 16 4 × N and N × 4 RST4 × 4 2 4 × N: up most all, nonZeroSize = (N >8) (16 × 16) (4 × N: up most 4 × 8; 4 × 8; 16 N × 4: left most 4 × 8) N× 4: left most 4 × 8 8 × 8 RST8 × 8 3 (with only 1 CG Top-left 4 × 4First 8 in diagonal (16 × 48) may have non-zero scan order (0..7 incoeffs after forward FIG. 16, RST) nonZeroSize = 8 Others RST8 × 8 3(with only 1 CG Top-left 4 × 4 all, nonZeroSize = (W*H, (16 × 48) mayhave non-zero 16 W > 8, coeffs after forward H > 8) RST)

2.4.3 Sub-Block Transform

For an inter-predicted CU with cu_cbf equal to 1, cu_sbt_flag may besignaled to indicate whether the whole residual block or a sub-part ofthe residual block is decoded. In the former case, inter MTS informationis further parsed to determine the transform type of the CU. In thelatter case, a part of the residual block is coded with inferredadaptive transform and the other part of the residual block is zeroedout. The SBT is not applied to the combined inter-intra mode.

In sub-block transform, position-dependent transform is applied on lumatransform blocks in SBT-V and SBT-H (chroma TB always using DCT-2). Thetwo positions of SBT-H and SBT-V are associated with different coretransforms. More specifically, the horizontal and vertical transformsfor each SBT position is specified in FIG. 3. For example, thehorizontal and vertical transforms for SBT-V position 0 is DCT-8 andDST-7, respectively. When one side of the residual TU is greater than32, the corresponding transform is set as DCT-2. Therefore, thesub-block transform jointly specifies the TU tiling, cbf, and horizontaland vertical transforms of a residual block, which may be considered asyntax shortcut for the cases that the major residual of a block is atone side of the block.

2.4.3.1 Syntax Elements

7.3.7.5 Coding Unit Syntax

Descriptor coding_unit( x0, y0, cbWidth, cbHeight, treeType ) {  if(slice_type != I | | sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA )    cu_skip_flag[ x0 ][ y0 ] ae(v)   if( cu_skip_flag[x0 ][ y0 ] = = 0 && slice_type != I )    pred_mode_flag ae(v)   if( ( (slice_type = = I && cu_skip_flag[ x0 ][ y0 ] = =0 ) | |    ( slice_type!= I && CuPredMode[ x0 ][ y0 ] != MODE_INTRA ) )    &&sps_ibc_enabled_flag )    pred_mode_ibc_flag ae(v)  }  if( CuPredMode[x0 ][ y0 ] = = MODE_INTRA ) { ...  } else if( treeType !=DUAL_TREE_CHROMA ) { /* MODE_INTER or  MODE_IBC */ ...  }  if(!pcm_flag[ x0 ][ y0 ] ) {   if( CuPredMode[ x0 ][ y0 ] != MODE_INTRA &&merge_flag[ x0 ]   [ y0 ] = = 0 )    cu_cbf ae(v)   if( cu_cbf ) {   if( CuPredMode[ x0 ][ y0 ] = = MODE_INTER && sps_sbt_enabled_    flag && !ciip_flag[ x0 ][ y0 ] ) {     if( cbWidth <= MaxSbtSize &&cbHeight <= MaxSbtSize ) {      allowSbtVerH = cbWidth >= 8     allowSbtVerQ = cbWidth >= 16      allowSbtHorH = cbHeight >= 8     allowSbtHorQ = cbHeight >= 16      if( allowSbtVerH | |allowSbtHorH | | allowSbtVerQ | |      allowSbtHorQ )       cu_sbt_flagae(v)     }     if( cu_sbt_flag ) {      if( ( allowSbtVerH | |allowSbtHorH ) && ( allowSbtVerQ | |      allowSbtHorQ) )      cu_sbt_quad_flag ae(v)      if( ( cu_sbt_quad_flag && allowSbtVerQ&& allowSbtHorQ ) | |       ( !cu_sbt_quad_flag && allowSbtVerH &&allowSbtHorH ) )       cu_sbt_horizontal_flag ae(v)      cu_sbt_pos_flagae(v)     }    }    transform_tree( x0, y0, cbWidth, cbHeight, treeType)   }  } }cu_sbt_flag equal to 1 specifies that for the current coding unit,subblock transform is used. cu_sbt_flag equal to 0 specifies that forthe current coding unit, subblock transform is not used.When cu_sbt_flag is not present, its value is inferred to be equal to 0.

NOTE—: When subblock transform is used, a coding unit is split into twotransform units; one transform unit has residual data, the other doesnot have residual data.

cu_sbt_quad_flag equal to 1 specifies that for the current coding unit,the subblock transform includes a transform unit of ¼ size of thecurrent coding unit. cu_sbt_quad_flag equal to 0 specifies that for thecurrent coding unit the subblock transform includes a transform unit of½ size of the current coding unit.When cu_sbt_quad_flag is not present, its value is inferred to be equalto 0.cu_sbt_horizontal_flag equal to 1 specifies that the current coding unitis split horizontally into 2 transform units.cu_sbt_horizontal_flag[×0][y0] equal to 0 specifies that the currentcoding unit is split vertically into 2 transform units.When cu_sbt_horizontal_flag is not present, its value is derived asfollows:

-   -   If cu_sbt_quad_flag is equal to 1, cu_sbt_horizontal_flag is set        to be equal to allowSbtHorQ.    -   Otherwise (cu_sbt_quad_flag is equal to 0),        cu_sbt_horizontal_flag is set to be equal to allowSbtHorH.        cu_sbt_pos_flag equal to 1 specifies that the tu_cbf_luma,        tu_cbf_cb and tu_cbf_cr of the first transform unit in the        current coding unit are not present in the bitstream.        cu_sbt_pos_flag equal to 0 specifies that the tu_cbf_luma,        tu_cbf_cb and tu_cbf_cr of the second transform unit in the        current coding unit are not present in the bitstream.

The variable SbtNumFourthsTb0 is derived as follows:

sbtMinNumFourths=cu_sbt_quad_flag?1:2  (7-117)

SbtNumFourthsTb0=cu_sbt_pos_flag?(4−sbtMinNumFourths):sbtMinNumFourths  (7-118)

sps_sbt_max_size_64_flag equal to 0 specifies that the maximum CU widthand height for allowing subblock transform is 32 luma samples.sps_sbt_max_size_64_flag equal to 1 specifies that the maximum CU widthand height for allowing subblock transform is 64 luma samples.

MaxSbtSize=sps_sbt_max_size_64_flag?64:32  (7-33)

2.4.4 Quantized Residual Domain Block Differential Pulse-Code ModulationCoding (QR-BDPCM)

In JVET-N0413, quantized residual domain BDPCM (denote as RBDPCMhereinafter) is proposed. The intra prediction is done on the entireblock by sample copying in prediction direction (horizontal or verticalprediction) similar to intra prediction. The residual is quantized andthe delta between the quantized residual and its predictor (horizontalor vertical) quantized value is coded.

For a block of size M (rows)×N (cols), let r_(i,j), 0≤i≤M−1, 0≤j≤N−1. bethe prediction residual after performing intra prediction horizontally(copying left neighbor pixel value across the predicted block line byline) or vertically (copying top neighbor line to each line in thepredicted block) using unfiltered samples from above or left blockboundary samples. Let Q(r_(i,j)), 0≤i≤M−1, 0≤j≤N−1 denote the quantizedversion of the residual r_(i,j), where residual is difference betweenoriginal block and the predicted block values. Then the block DPCM isapplied to the quantized residual samples, resulting in modified M×Narray {tilde over (R)} with elements {tilde over (r)}_(i,j). Whenvertical BDPCM is signaled:

${\overset{˜}{r}}_{i,j} = \left\{ \begin{matrix}{{{Q\left( r_{i,j} \right)}\ ,}\ } & {{i = 0},\ {0 \leq j \leq \left( {N - 1} \right)}} \\{{{{Q\left( r_{i,j} \right)} - {Q\left( r_{{({i - 1})},j} \right)}}\ ,}\ } & {{1 \leq i \leq \left( {M - 1} \right)},\mspace{11mu}{0 \leq j \leq \left( {N - 1} \right)}}\end{matrix} \right.$

For horizontal prediction, similar rules apply, and the residualquantized samples are obtained by

${\overset{˜}{r}}_{i,j} = \left\{ \begin{matrix}{{Q\left( r_{i,j} \right)}\ ,} & {{0 \leq i \leq \left( {M - 1} \right)},\ {j = 0}} \\{{{{Q\left( r_{i,j} \right)} - {Q\left( r_{i,{({j - 1})}} \right)}}\ ,}\ } & {{0 \leq i \leq \left( {M - 1} \right)}\ ,\ {1 \leq j \leq \left( {N - 1} \right)}}\end{matrix} \right.$

The residual quantized samples {tilde over (r)}_(i,j) are sent to thedecoder.

On the decoder side, the above calculations are reversed to produceQ(r_(i,j)), 0≤i≤M−1, 0≤j≤N−1. For vertical prediction case,

Q(r _(i,j))=Σ_(k=0) ^(i) {tilde over (r)} _(k,j),0≤i≤(M−1),0≤j≤(N−1)

For horizontal case,

Q(r _(i,j))=Σ_(k=0) ^(i)0≤i≤(M−1),0≤j≤(N−1)

The invert quantized residuals, Q⁻¹ (Q(r_(i,j))), are added to the intrablock prediction values to produce the reconstructed sample values.

When QR-BDPCM is selected, there is no transform applied.

2.5 Entropy Coding of Coefficients

2.5.1 Coefficients Coding of Transform-Applied Blocks

In HEVC, transform coefficients of a coding block are coded usingnon-overlapped coefficient groups (or subblocks), and each CG containsthe coefficients of a 4×4 block of a coding block. The CGs inside acoding block, and the transform coefficients within a CG, are codedaccording to pre-defined scan orders.

The CGs inside a coding block, and the transform coefficients within aCG, are coded according to pre-defined scan orders. Both CG andcoefficients within a CG follows the diagonal up-right scan order. Anexample for 4×4 block and 8×8 scanning order is depicted in FIG. 16 andFIG. 17, respectively.

Note that the coding order is the reversed scanning order (i.e.,decoding from CG3 to CG0 in FIG. 17), when decoding one block, the lastnon-zero coefficient's coordinate is firstly decoded.

The coding of transform coefficient levels of a CG with at least onenon-zero transform coefficient may be separated into multiple scanpasses. In the first pass, the first bin (denoted by bin0, also referredas significant_coeff_flag, which indicates the magnitude of thecoefficient is larger than 0) is coded. Next, two scan passes forcontext coding the second/third bins (denoted by bin1 and bin2,respectively, also referred as coeff_abs_greater1_flag andcoeff_abs_greater2_flag) may be applied. Finally, two more scan passesfor coding the sign information and the remaining values (also referredas coeff_abs_level_remaining) of coefficient levels are invoked, ifnecessary. Note that only bins in the first three scan passes are codedin a regular mode and those bins are termed regular bins in thefollowing descriptions.

In the VVC 3, for each CG, the regular coded bins and the bypass codedbins are separated in coding order; first all regular coded bins for asubblock are transmitted and, thereafter, the bypass coded bins aretransmitted. The transform coefficient levels of a subblock are coded infive passes over the scan positions as follows:

-   -   Pass 1: coding of significance (sig_flag), greater 1 flag        (gt1_flag), parity (par_level_flag) and greater 2 flags        (gt2_flag) is processed in coding order. If sig_flag is equal to        1, first the gt1_flag is coded (which specifies whether the        absolute level is greater than 1). If gt1_flag is equal to 1,        the par_flag is additionally coded (it specifies the parity of        the absolute level minus 2).    -   Pass 2: coding of remaining absolute level (remainder) is        processed for all scan positions with gt2_flag equal to 1 or        gt1_flag equal to 1. The non-binary syntax element is binarized        with Golomb-Rice code and the resulting bins are coded in the        bypass mode of the arithmetic coding engine.    -   Pass 3: absolute level (absLevel) of the coefficients for which        no sig_flag is coded in the first pass (due to reaching the        limit of regular-coded bins) are completely coded in the bypass        mode of the arithmetic coding engine using a Golomb-Rice code.    -   Pass 4: coding of the signs (sign_flag) for all scan positions        with sig_coeff_flag equal to 1

It is guaranteed that no more than 32 regular-coded bins (sig_flag,par_flag, gt1_flag and gt2_flag) are encoded or decoded for a 4×4subblock. For 2×2 chroma subblocks, the number of regular-coded bins islimited to 8.

The Rice parameter (ricePar) for coding the non-binary syntax elementremainder (in Pass 3) is derived similar to HEVC. At the start of eachsubblock, ricePar is set equal to 0. After coding a syntax elementremainder, the Rice parameter is modified according to predefinedequation. For coding the non-binary syntax element absLevel (in Pass 4),the sum of absolute values sumAbs in a local template is determined. Thevariables ricePar and posZero are determined based on dependentquantization and sumAbs by a table look-up. The intermediate variablecodeValue is derived as follows:

-   -   If absLevel[k] is equal to 0, codeValue is set equal to posZero;    -   Otherwise, if absLevel[k] is less than or equal to posZero,        codeValue is set equal to absLevel[k]−1;    -   Otherwise (absLevel[k] is greater than posZero), codeValue is        set equal to absLevel[k].

The value of codeValue is coded using a Golomb-Rice code with Riceparameter ricePar.

2.5.1.1 Context Modeling for Coefficient Coding

The selection of probability models for the syntax elements related toabsolute values of transform coefficient levels depends on the values ofthe absolute levels or partially reconstructed absolute levels in alocal neighbourhood. The template used is illustrated in FIG. 18.

The selected probability models depend on the sum of the absolute levels(or partially reconstructed absolute levels) in a local neighborhood andthe number of absolute levels greater than 0 (given by the number ofsig_coeff_flags equal to 1) in the local neighborhood. The contextmodelling and binarization depends on the following measures for thelocal neighborhood:

-   -   numSig: the number of non-zero levels in the local neighborhood;    -   sumAbs1: the sum of partially reconstructed absolute levels        (absLevel1) after the first pass in the local neighborhood;    -   sumAbs: the sum of reconstructed absolute levels in the local        neighborhood    -   diagonal position (d): the sum of the horizontal and vertical        coordinates of a current scan position inside the transform        block

Based on the values of numSig, sumAbs1, and d, the probability modelsfor coding sig_flag, par_flag, gt1_flag, and gt2_flag are selected. TheRice parameter for binarizing abs_remainder is selected based on thevalues of sumAbs and numSig.

2.5.1.2 Dependent Quantization (DQ)

In addition, the same HEVC scalar quantization is used with a newconcept called dependent scale quantization. Dependent scalarquantization refers to an approach in which the set of admissiblereconstruction values for a transform coefficient depends on the valuesof the transform coefficient levels that precede the current transformcoefficient level in reconstruction order. The main effect of thisapproach is that, in comparison to conventional independent scalarquantization as used in HEVC, the admissible reconstruction vectors arepacked denser in the N-dimensional vector space (N represents the numberof transform coefficients in a transform block). That means, for a givenaverage number of admissible reconstruction vectors per N-dimensionalunit volume, the average distortion between an input vector and theclosest reconstruction vector is reduced. The approach of dependentscalar quantization is realized by: (a) defining two scalar quantizerswith different reconstruction levels and (b) defining a process forswitching between the two scalar quantizers.

The two scalar quantizers used, denoted by Q0 and Q1, are illustrated inFIG. 19. The location of the available reconstruction levels is uniquelyspecified by a quantization step size A. The scalar quantizer used (Q0or Q1) is not explicitly signalled in the bitstream. Instead, thequantizer used for a current transform coefficient is determined by theparities of the transform coefficient levels that precede the currenttransform coefficient in coding/reconstruction order.

As illustrated in FIG. 20, the switching between the two scalarquantizers (Q0 and Q1) is realized via a state machine with four states.The state can take four different values: 0, 1, 2, 3. It is uniquelydetermined by the parities of the transform coefficient levels precedingthe current transform coefficient in coding/reconstruction order. At thestart of the inverse quantization for a transform block, the state isset equal to 0. The transform coefficients are reconstructed in scanningorder (i.e., in the same order they are entropy decoded). After acurrent transform coefficient is reconstructed, the state is updated asshown in FIG. 20, where k denotes the value of the transform coefficientlevel.

2.5.1.3 Syntax and Semantics

7.3.7.11 Residual Coding Syntax

Descriptor residual_coding( x0, y0, log2TbWidth, log2TbHeight, cIdx ) { if( ( tu_mts_idx[ x0 ][ y0 ] > 0 | |   ( cu_sbt_flag && log2TbWidth < 6&& log2TbHeight < 6 ) )   && cIdx = = 0 && log2TbWidth > 4 ) log2TbWidth = 4  else   log2TbWidth = Min( log2TbWidth, 5 )  if(tu_mts_idx[ x0 ][ y0 ] > 0 | |   ( cu_sbt_flag && log2TbWidth < 6 &&log2TbHeight < 6 ) )   && cIdx = = 0 && log2TbHeight > 4 )  log2TbHeight = 4  else   log2TbHeight = Min( log2TbHeight, 5 )  if(log2TbWidth > 0 )   last_sig_coeff_x_prefix ae(v)  if( log2TbHeight > 0)   last_sig_coeff_y_prefix ae(v)  if( last_sig_coeff_x_prefix > 3 )  last_sig_coeff_x_suffix ae(v)  if( last_sig_coeff_y_prefix > 3 )  last_sig_coeff_y_suffix ae(v)  log2SbW = ( Min( log2TbWidth,log2TbHeight ) < 2 ? 1 : 2 )  log2SbH = log2SbW  if ( log2TbWidth < 2 &&cIdx = = 0 ) {   log2SbW = log2TbWidth   log2SbH = 4 − log2SbW  } elseif ( log2TbHeight < 2 && cIdx = = 0 ) {   log2SbH = log2TbHeight  log2SbW = 4 − log2SbH  }  numSbCoeff = 1 << ( log2SbW + log2SbH ) lastScanPos = numSbCoeff  lastSubBlock = ( 1 << ( log2TbWidth +log2TbHeight − ( log2SbW +  log2SbH ) ) ) − 1  do {   if( lastScanPos == 0 ) {    lastScanPos = numSbCoeff    lastSubBlock− −   }  lastScanPos− −   xS = DiagScanOrder[ log2TbWidth − log2SbW ][log2TbHeight − log2SbH ]      [ lastSubBlock ][ 0 ]   yS =DiagScanOrder[ log2TbWidth − log2SbW ][ log2TbHeight − log2SbH ]      [lastSubBlock ][ 1 ]   xC = ( xS << log2SbW ) + DiagScanOrder[ log2SbW ][log2SbH ]   [ lastScanPos ][ 0 ]   yC = ( yS << log2SbH ) +DiagScanOrder[ log2SbW ][ log2SbH ]   [ lastScanPos ][ 1 ]  } while( (xC != LastSignificantCoeffX ) | | ( yC != LastSignificantCoeffY ) ) QState = 0  for( i = lastSubBlock; i >= 0; i− − ) {   startQStateSb =QState   xS = DiagScanOrder[ log2TbWidth − log2SbW ][ log2TbHeight −log2SbH ]      [ lastSubBlock ][ 0 ]   yS = DiagScanOrder[ log2TbWidth −log2SbW ][ log2TbHeight − log2SbH ]      [ lastSubBlock ][ 1 ]  inferSbDcSigCoeffFlag = 0   if( ( i < lastSubBlock ) && ( i > 0 ) ) {   coded_sub_block_flag[ xS ][ yS ] ae(v)    inferSbDcSigCoeffFlag = 1  }   firstSigScanPosSb = numSbCoeff   lastSigScanPosSb = −1  remBinsPass1 = ( ( log2SbW + log2SbH ) < 4 ? 8 : 32 )   firstPosMode0= ( i = = lastSubBlock ? lastScanPos : numSbCoeff − 1 )   firstPosMode1= −1   for( n = firstPosMode0; n >= 0 && remBinsPass1 >= 4; n− − ) {   xC = ( xS << log2SbW ) + DiagScanOrder[ log2SbW ][ log2SbH ][ n ]   [ 0 ]    yC = ( yS << log2SbH ) + DiagScanOrder[ log2SbW ][ log2SbH][ n ]    [ 1 ]    if( coded_sub_block_flag[ xS ][ yS ] && ( n > 0 | |    !inferSbDcSigCoeffFlag ) && ( xC != LastSignificantCoeffX | | yC !=    LastSignificantCoeffY ) ) {     {sig_coeff_flag[ xC ][ yC ] ae(v)    remBinsPass1− −     if( sig_coeff_flag[ xC ][ yC ] )     inferSbDcSigCoeffFlag = 0    }    if( sig_coeff_flag[ xC ][ yC ] ){     abs_level_gt1_flag[ n ] ae(v)     remBinsPass1− −     if(abs_level_gt1_flag[ n ] ) {      par_level_flag[ n ] ae(v)     remBinsPass1− −      abs_level_gt3_flag[ n ] ae(v)     remBinsPass1− −    }    if( lastSigScanPosSb = = −1 )    lastSigScanPosSb = n    firstSigScanPosSb = n   }   AbsLevelPass1[xC ][ yC ] = sig_coeff_flag[ xC ][ yC ] + par_level_flag       [ n ] +abs_level_gt1_flag[ n ] + 2 * abs_level_gt3_flag[ n ]   if(dep_quant_enabled_flag )    QState = QStateTransTable[ QState ][AbsLevelPass1[ xC ][ yC ] & 1 ]     if( remBinsPass1 < 4 )   firstPosMode1 = n − 1   }   for( n = numSbCoeff − 1; n >=firstPosMode1; n− − ) {    xC = ( xS << log2SbW ) + DiagScanOrder[log2SbW ][ log2SbH ][ n ]    [ 0 ]    yC = ( yS << log2SbH ) +DiagScanOrded[ log2SbW ][ log2SbH ][ n ]    [ 1 ]    if(abs_level_gt3_flag[ n ] )     abs_remainder[ n ] ae(v)    AbsLevel[ xC][ yC ] = AbsLevelPass1[ xC ][ yC ] +2 * abs_remainder    [ n ]   }  for( n = firstPosMode1; n >= 0; n− − ) {    xC = ( xS << log2SbW ) +DiagScanOrder[ log2SbW ][ log2SbH ][ n ]    [ 0 ]    yC = ( yS <<log2SbH ) + DiagScanOrder[ log2SbW ][ log2SbH ][ n ]    [ 1 ]   dec_abs_level[ n ] ae(v)    if(AbsLevel[ xC ][ yC ] > 0 )    firstSigScanPosSb = n    if( dep_quant_enabled_flag )     QState =QStateTransTable[ QState ][ AbsLevel[ xC ][ yC ] & 1 ]   }   if(dep_quant_enabled_flag | | !sign_data_hiding_enabled_flag )   signHidden = 0   else    signHidden = ( lastSigScanPosSb −firstSigScanPosSb > 3 ? 1 : 0 )   for( n = numSbCoeff − 1; n >= 0; n− −) {    xC = ( xS << log2SbW ) + DiagScanOrder[ log2SbW ][ log2SbH ][ n ]   [ 0 ]    yC = ( yS << log2SbH ) + DiagScanOrder[ log2SbW ][ log2SbH][ n ]    [ 1 ]    if( ( AbsLevel[ xC ][ yC ] > 0 ) &&     ( !signHidden| | ( n != firstSigScanPosSb ) ) )     coeff_sign_flag[ n ] ae(v)    }   if( dep_quant_enabled_flag ) {     QState = startQStateSb     for( n= numSbCoeff − 1; n >= 0; n− − ) {      xC = ( xS << log2SbW ) +DiagScanOrder[ log2SbW ][ log2SbH ]      [ n ][ 0 ]      yC = ( yS <<log2SbH ) + DiagScanOrder[ log2SbW ][ log2SbH ]      [ n ][ 1 ]      if(AbsLevel[ xC ][ yC ] > 0 )       TransCoeffLevel[ x0 ][ y0 ][ cIdx ][ xC][ yC ] =        ( 2 * AbsLevel[ xC ][ yC ] − ( QState > 1 ? 1 : 0 ) ) *       ( 1 − 2 * coeff_sign_flag[ n ] )      QState = QStateTransTable[QState ][ par_level_flag[ n ] ]     } else {      sumAbsLevel = 0     for( n = numSbCoeff − 1; n >= 0; n− − ) {       xC = ( xS <<log2SbW ) + DiagScanOrder[ log2SbW ][ log2SbH ]       [ n ][ 0 ]      yC = ( yS << log2SbH ) + DiagScanOrder[ log2SbW ][ log2SbH ]      [ n ][ 1 ]       if( AbsLevel[ xC ][ yC ] > 0 ) {       TransCoeffLevel[ x0 ][ y0 ][ cIdx ][ xC ][ yC ] =        AbsLevel[ xC ][ yC ] * ( 1 − 2 * coeff_sign_flag[ n ] )       if( signHidden ) {         sumAbsLevel += AbsLevel[ xC ][ yC ]        if( ( n = = firstSigScanPosSb ) && ( sumAbsLevel % 2 ) = = 1 ) )         TransCoeffLevel[ x0 ][ y0 ][ cIdx ][ xC ][ yC ] =          ...TransCoeffLevel[ x0 ][ y0 ][ cIdx ][ xC ][ yC ]        }      }      }     }    }   }

2.5.2 Coefficients Coding of TS-Coded Blocks and QR-BDPCM Coded Blocks

QR-BDPCM follows the context modeling method for TS-coded blocks.

A modified transform coefficient level coding for the TS residual.Relative to the regular residual coding case, the residual coding for TSincludes the following changes:

(1) no signalling of the last x/y position

(2) coded_sub_block_flag coded for every subblock except for the lastsubblock when all previous flags are equal to 0;

(3) sig_coeff_flag context modelling with reduced template,

(4) a single context model for abs_level_gt1 flag and par_level_flag,

(5) context modeling for the sign flag, additional greater than 5, 7, 9flags,

(6) modified Rice parameter derivation for the remainder binarization

(7) a limit for the number of context coded bins per sample, 2 bins persample within one block.

2.5.2.1 Syntax and Semantics

7.3.6.10 Transform Unit Syntax

Descriptor transform_unit( x0, y0, tbWidth, tbHeight, treeType,subTuIndex ) { ...  if( tu_cbf_luma[ x0 ][ y0 ] && treeType !=DUAL_TREE_CHROMA   && ( tbWidth <= 32 ) && ( tbHeight <= 32 )   && (IntraSubPartitionsSplit[ x0 ][ y0 ] = = ISP_NO_SPLIT ) && ( !cu_sbt_flag) ) {   if( transform_skip_enabled_flag && tbWidth <= MaxTsSize &&tbHeight <=   MaxTsSize )    transform_skip_flag[ x0 ][ y0 ] ae(v)   if((( CuPredMode[ x0 ][ y0 ] != MODE_INTRA &&sps_explicit_mts_inter_enabled_    flag ) | | ( CuPredMode[ x0 ][ y0 ] == MODE_INTRA && sps_explicit_mts_intra_    enabled_flag )) && ( tbWidth<= 32 ) && ( tbHeight <= 32 ) && ( !transform_skip_    flag[ x0 ][ y0 ]) )    tu_mts_idx[ x0 ][ y0 ] ae(v)  }  if( tu_cbf_luma[ x0 ][ y0 ] ) {  if( !transform_skip_flag[ x0 ][ y0 ] )    residual_coding( x0, y0,Log2( tbWidth), Log2( tbHeight ), 0 )   else    residual_coding_ts( x0,y0, Log2( tbWidth ), Log2( tbHeight ), 0 )  }  if( tu_cbf_cb[ x0 ][ y0 ])   residual_coding( xC, yC, Log2( wC ), Log2( hC ), 1 )  if( tu_cbf_cr[x0 ][ y0 ] )   residual_coding( xC, yC, Log2( wC ), Log2( hC ), 2 ) }residual_ts_coding( x0, y0, log2TbWidth, log2TbHeight, cIdx ) { log2SbSize = ( Min( log2TbWidth, log2TbHeight ) < 2 ? 1 : 2 ) numSbCoeff = 1 << ( log2SbSize << 1 )  lastSubBlock = ( 1 << (log2TbWidth + log2TbHeight − 2 * log2SbSize ) ) − 1 /* Loop oversubblocks from top-left (DC) subblock to the last one */  inferSbCbf = 1 MaxCcbs = 2 * ( 1 << log2TbWidth ) * ( 1<< log2TbHeight )  for( i =0; i<= lastSubBlock; i++ ) {   xS = DiagScanOrder[ log2TbWidth − log2SbSize][ log2TbHeight −log2SbSize ][ i ][ 0 ]   yS = DiagScanOrder[log2TbWidth − log2SbSize ][ log2TbHeight −log2SbSize ][ i ][ 1 ]   if( (i != lastSubBlock | | !inferSbCbf )    coded_sub_block_flag[ xS ][ yS ]ae(v)    MaxCcbs− −   if( coded_sub_block_flag[ xS ][ yS ] && i <lastSubBlock )    inferSbCbf = 0   }  /* First scan pass */  inferSbSigCoeffFlag = 1   for( n = ( i = = 0; n <= numSbCoeff − 1; n++) {    xC = ( xS << log2SbSize ) + DiagScanOrder[ log2SbSize ][log2SbSize ][ n ][ 0 ]    yC = ( yS << log2SbSize ) + DiagScanOrder[log2SbSize ][ log2SbSize ][ n ][ 1 ]    if( coded_sub_block_flag[ xS ][yS ] &&     ( n == numSbCoeff − 1 | | !inferSbSigCoeffFlag ) ) {    sig_coeff_flag[ xC ][ yC ] ae(v)     MaxCcbs− −     if(sig_coeff_flag[ xC ][ yC ] )      inferSbSigCoeffFlag = 0   }   if(sig_coeff_flag[ xC ][ yC ] ) {    coeff_sign_flag[ n ] ae(v)   abs_level_gtx_flag[ n ][ 0 ] ae(v)    MaxCcbs = MaxCcbs − 2    if(abs_level_gtx_flag[ n ][ 0 ] ) {     par_level_flag[ n ] ae(v)    MaxCcbs− −    }   }   AbsLevelPassX[ xC ][ yC ] =    sig_coeff_flag[xC ][ yC ] + par_level_flag[ n ] + abs_level_gtx_flag[ n ][ 0 ]  } /*Greater than X scan passes (numGtXFlags=5) */  for( i = 1; i <= 5 − 1 &&abs_level_gtx_flag[ n ][ i − 1 ] ; i++ ) {   for( n = 0; n <= numSbCoeff− 1; n++ ) {    xC = ( xS << log2SbSize ) + DiagScanOrder[ log2SbSize ][log2SbSize ][ n ][ 0 ]    yC = ( yS << log2SbSize ) + DiagScanOrder[log2SbSize ][ log2SbSize ][ n ][ 1 ]    abs_level_gtx_flag[ n ][ i ]ae(v)    MaxCcbs− −    AbsLevelPassX[ xC ][ yC ] + = 2 *abs_level_gtx_flag[ n ]    [ i ]   }  } /* remainder scan pass */  for(n = 0; n <= numSbCoeff − 1; n++ ) {   xC = ( xS << log2SbSize ) +DiagScanOrder[ log2SbSize ][ log2SbSize ][ n ][ 0 ]   yC = ( yS <<log2SbSize ) + DiagScanOrder[ log2SbSize ][ log2SbSize ][ n ][ 1 ]   if(abs_level_gtx_flag[ n ][ numGtXFlags − 1 ] )    abs_remainder[ n ] ae(v)  TransCoeffLevel[ x0 ][ y0 ][ cIdx ][ xC ][ yC ] = ( 1 − 2 *coeff_sign_flag[ n ] ) *        ( AbsLevelPassX[ xC ][ yC ] +abs_remainder[ n ] )   }  } }The number of context coded bins is restricted to be no larger than 2bins per sample for each CG.

TABLE 9-15 Assignment of ctxInc to syntax elements with context codedbins binIdx Syntax element 0 1 2 3 4 >= 5 last_sig_coeff_x_prefix 0 . .. 23 (clause 9.5.4.2.4) last_sig_coeff_y_prefix 0 . . . 23 (clause9.5.4.2.4) last_sig_coeff_x_suffix bypass bypass bypass bypass bypassbypass last_sig_coeff_y_suffix bypass bypass bypass bypass bypass bypasscoded_sub_block_flag[ ][ ] ( MaxCcbs > 0) ? ( 0 . . . 7 na na na na na(clause 9.5.4.2.6) ) : bypass sig_coeff_flag[ ][ ] ( MaxCcbs > 0) ? ( 0. . . 93 na na na na na (clause 9.5.4.2.8) ) : bypass par_level_flag[ ]( MaxCcbs > 0) ? ( 0 . . . 33 na na na na na (clause 9.5.4.2.9) ) :bypass abs_level_gtx_flag[ ][ i ] 0 . . . 70 na na na na na (clause9.5.4.2.9) abs_remainder[ ] bypass bypass bypass bypass bypass bypassdec_abs_level[ ] bypass bypass bypass bypass bypass bypasscoeff_sign_flag[ ] bypass na na na na na transform_skip_flag[ x0 ][ y0 ]= = 0 coeff_sign_flag[ ] 0 na na na na na transform_skip_flag[ x0 ][ y0] = = 1

Drawbacks of Existing Implementations

The current design has the following problems:

(1) The four pre-defined transform sets for chroma components is thesame as that for luma component. In addition, luma and chroma blockswith the same intra prediction mode use the same transform set. However,the chroma signal is typically smoother compared to the luma component.Using the same set may be sub-optimal.

(2) RST is only applied to certain CGs instead of all CGs. However, thedecision on signaling RST index is dependent on the number of non-zerocoefficients in the whole block. When all coefficients in theRST-applied CGs are zeros, there is no need to signal the RST index.However, the current design may still signal the index which wastesunnecessary bits.

(3) RST index is signaled after residual coding since it requires torecord how many non-zero coefficients, whether there exists non-zerocoefficient in certain locations (e.g., numZeroOutSigCoeff, numSigCoeffin section 2.3.2.2.7). Such design makes the parsing process morecomplex.

(4) RST index is context coded and context modeling is dependent on thecoded luma/chroma intra prediction mode, and MTS index. Such designintroduces parsing delay in terms of reconstruction of intra predictionmodes. And 8 contexts are introduced which may be a burden for hardwareimplementation.

-   -   (a) DM and CCLM share the same context index offset which        doesn't make sense since they are two different chroma intra        prediction methods.

(5) The current design of non-TS residual coding firstly codes thecoefficients information, followed by the indices of RST (i.e., use RSTor not, if used, which matrix is selected). With such design, theinformation of RST on/off couldn't be taken into consideration in theentropy coding of residuals.

(6) RST is always applied to the top-left region of a transform blockwith primary transform applied. However, for different primary transformbasis, it is not always true that the energy is concentrated in thetop-left region of a transform block.

Example Methods for Context Modeling for Residual Coding

Embodiments of the presently disclosed technology overcome the drawbacksof existing implementations, thereby providing video coding with highercoding efficiencies. The methods for context modeling for residualcoding, based on the disclosed technology, may enhance both existing andfuture video coding standards, is elucidated in the following examplesdescribed for various implementations. The examples of the disclosedtechnology provided below explain general concepts, and are not meant tobe interpreted as limiting. In an example, unless explicitly indicatedto the contrary, the various features described in these examples may becombined.

In these examples, the RST may be any variation of the design inJVET-N0193. RST could be any technology that may apply a secondarytransform to one block or apply a transform to the transform skip(TS)-coded block (e.g., the RST proposed in JVET-N0193 applied to theTS-coded block).

In addition, the ‘zero-out region’ or ‘zero-out CG’ may indicate thoseregions/CGs which always have zero coefficients due the reducedtransform size used in the secondary transform process. For example, ifthe secondary transform size is 16×32, and CG size is 4×4, it will beapplied to the first two CGs, but only the first CG may have non-zerocoefficients, the second 4×4 CG is also called zero-out CG.

Selection of Transform Matrices in RST

1. The sub-region that RST is applied to may be a sub-region which isnot the top-left part of a block.

-   -   a. In one example, RST may be applied to the top-right or        bottom-right or bottom-left or center sub-region of a block.    -   b. Which sub-region that RST is applied to may depend on the        intra prediction mode and/or primary transform matrix (e.g.,        DCT-II, DST-VII, Identity transform).

2. Selection of transform set and/or transform matrix used in RST maydepend on the color component.

-   -   a. In one example, one set of transform matrix may be used for        luma (or G) component, and one set for chroma components (or        B/R).    -   b. In one example, each color component may correspond to one        set.    -   c. In one example, at least one matrix is different in any of        the two or multiple sets for different color components.

3. Selection of transform set and/or transform matrix used in RST maydepend on intra prediction method (e.g., CCLM, multiple reference linebased intra prediction method, matrix-based intra prediction method).

-   -   a. In one example, one set of transform matrix may be used for        CCLM coded blocks, and the other for non-CCLM coded blocks.    -   b. In one example, one set of transform matrix may be used for        normal intra prediction coded blocks, and the other for multiple        reference line enabled blocks (i.e., which doesn't use the        adjacent line for intra prediction).    -   c. In one example, one set of transform matrix may be used for        blocks with joint chroma residual coding, and the other for        blocks which joint chroma residual coding is not applied.    -   d. In one example, at least one matrix is different in any of        the two or multiple sets for different intra prediction methods.    -   e. Alternatively, RST may be disabled for blocks coded with        certain intra prediction directions and/or certain coding tools,        e.g., CCLM, and/or joint chroma residual coding, and/or certain        color component (e.g., chroma).

4. Selection of transform set and/or transform matrices used in RST maydepend on the primary transform.

-   -   a. In one example, if the primary transform applied to one block        is the identity transform (e.g., TS mode is applied to one        block), the transform set and/or transform matrices used in RST        may be different from other kinds of primary transform.    -   b. In one example, if the horizontal and vertical 1-D primary        transform applied to one block is the same basis (e.g., both        DCT-II), the transform set and/or transform matrices used in RST        may be different from that primary transforms from different        basis for different directions (vertical or horizontal).

Signaling of RST Side Information and Residual Coding

5. Whether to and/how to signal the side information of RST (e.g.,st_idx) may depend on the last non-zero coefficient (in scanning order)in the block.

-   -   a. In one example, only if the last non-zero coefficient is        located in the CGs that RST applied to, RST may be enabled, and        the index of RST may be signaled.    -   b. In one example, if the last non-zero coefficient is not        located in the CGs that RST applied to, RST is disabled and        signaling of RST is skipped.

6. Whether to and/how to signal the side information of RST (e.g.,st_idx) may depend on coefficients within a partial region of one blockinstead of the whole block.

-   -   a. In one example, partial region may be defined as the CGs that        RST is applied to.    -   b. In one example, partial region may be defined as the first or        last M (e.g., M=1, or 2) CGs in scanning order or reverse        scanning order of the block.        -   i. In one example, M may depend on block dimension.        -   ii. In one example, M is set to 2 if block size is 4×N            and/or N×4 (N>8).        -   iii. In one example, M is set to 1 if block size is 4×8            and/or 8×4 and/or W×H (W>=8, H>=8).    -   c. In one example, it may depend on the position of non-zero        coefficients within a partial region.    -   d. In one example, it may depend on the energy (such as sum of        squares or sum of absolute values) of non-zero coefficients        within a partial region.    -   e. In one example, it may depend on the number of non-zero        coefficients within a partial region of one block instead of the        whole block.        -   i. When the number of non-zero coefficients within partial            region of one block is less than a threshold, signaling of            the side information of RST may be skipped.        -   ii. In one example, the threshold may depend on the slice            type/picture type/partition tree type (dual or single)/video            content (screen content or camera captured content).        -   iii. In one example, the threshold may depend on color            formats such as 4:2:0 or 4:4:4, and/or color components such            as Y or Cb/Cr.

7. When there are no non-zero coefficients in the CGs that RST may beapplied to, RST shall be disabled.

-   -   a. In one example, when RST is applied to one block, at least        one CG that RST is applied to must contain at least one non-zero        coefficient.    -   b. In one example, for 4×N and/or N×4 (N>8), if RST is applied,        the first two 4×4 CGs must contain at least one non-zero        coefficient.    -   c. In one example, for 4×8 and/or 8×4, if RST is applied, the        top-left 4×4 must contain at least one non-zero coefficient.    -   d. In one example, for W×H (W>=8 and H>=8), if RST is applied,        the top-left 4×4 must contain at least one non-zero coefficient.    -   e. A conformance bitstream must satisfy one or multiple of above        conditions.

8. RST related syntax elements may be signaled before coding residuals(e.g., transform coefficients/directly quantized).

-   -   a. In one example, the counting of number of non-zero        coefficients in the Zero-out region (e.g., numZeroOutSigCoeff)        and number of non-zero coefficients in the whole block (e.g.,        numSigCoeff) is removed in the parsing process of coefficients.    -   b. In one example, the RST related syntax elements (e.g, st_idx)        may be coded before residual_coding.    -   c. RST related syntax elements may be conditionally signaled        (e.g., according to coded block flags, TS mode usage).        -   iv. In one example, the RST related syntax elements (e.g,            st_idx) may be coded after the signaling of coded block            flags or after the signaling of TS/MTS related syntax            elements.        -   v. In one example, when TS mode is enabled (e.g., the            decoded transform_skip_flag is equal to 1), the signaling of            RST related syntax elements is skipped.    -   d. Residual related syntax may not be signaled for zero-out CGs.    -   e. How to code residuals (e.g., scanning order, binarization,        syntax to be decoded, context modeling) may depend on the RST.        -   i. In one example, raster scanning order instead of diagonal            up-right scanning order may be applied.            -   1) The raster scanning order is from left to right and                top to below, or in the reverse order.            -   2) Alternatively, vertical scanning order (from top to                below and from left to right, or in the reverse order)                instead of diagonal up-right scanning order may be                applied.            -   3) Alternatively, furthermore, context modeling may be                modified.                -   a. In one example, the context modeling may depend                    on the previously coded information in a template                    which are the most recent N neighbors in the scan                    order, instead of using right, bottom, bottom-right                    neighbors.                -   b. In one example, the context modeling may depend                    on the previously coded information in a template                    according to the scanned index (e.g., −1, −2, . . .                    assuming current index equal to 0).        -   ii. In one example, different binarization methods (e.g.,            rice parameter derivation) may be applied to code the            residuals associated with RST-coded and non-RST-coded            blocks.        -   iii. In one example, signaling of certain syntax elements            may be skipped for RST coded blocks.            -   1) Signaling of the CG coded block flags                (coded_sub_block_flag) for the CGs that RST is applied                to may be skipped.                -   a. In one example, when RST8×8 applied to the first                    three CGs in diagonal scan order, signaling of CG                    coded block flags is skipped for the second and                    third CGs, e.g., the top-right 4×4 CG and left-below                    4×4 CG in the top-left 8×8 region of the block.                -    i. Alternatively, furthermore, the corresponding CG                    coded block flag is inferred to be 0, i.e., all                    coefficients are zero.                -   b. In one example, when RST is applied to one block,                    signaling of CG coded block flag is skipped for the                    first CG in the scanning order (or the last CG in                    the reverse scanning order).                -    ii. Alternatively, furthermore, the CG coded block                    flag for the top-left CG in the block is inferred to                    be 1, i.e., it contains at least one non-zero                    coefficient.                -   c. An example of 8×8 block is depicted in FIG. 21.                    When RST8×8 or RST4×4 is applied to the 8×8 block,                    coded_sub_block_flag of CG0 is inferred to be 1,                    coded_sub_block_flag of CG1 and CG2 are inferred to                    be 0.            -   2) Signaling of the magnitudes of coefficients and/or                the sign flags for certain coordinates may be skipped.                -   a. In one example, if the index relative to one CG                    in a scan order is no less than the maximum allowed                    index that non-zero coefficient may exist (e.g.,                    nonZeroSize in section 0), the signaling of                    coefficients may be skipped.                -   b. In one example, signaling of the syntax elements,                    such as sig_coeff_flag, abs_level_gtX_flag,                    par_level_flag, abs_remainder, coeff_sign_flag,                    dec_abs_level may be skipped.            -   3) Alternatively, signaling of residuals (e.g., CG coded                block flags, the magnitudes of coefficients and/or the                sign flags for certain coordinates) may be kept,                however, the context modeling may be modified to be                different from other CGs.        -   iv. In one example, the coding of residuals in RST-applied            CGs and other CGs may be different.            -   1) For above sub-bullets, they may be applied only to                the CGs which RST are applied.

9. RST related syntax elements may be signaled before other transformindications, such as transform skip and/or MTS index.

-   -   a. In one example, the signaling of transform skip may depend on        RST information.        -   i. In one example, transform skip indication is not signaled            and inferred to be 0 for a block if RST is applied in the            block.    -   b. In one example, the signaling of MTS index may depend on RST        information.        -   i. In one example, one or multiple MTS transform indication            is not signaled and inferred to be not used for a block if            RST is applied in the block.

10. It is proposed to use different context modeling methods inarithmetic coding for different parts within one block.

-   -   a. In one example, the block is treated to be two parts, the        first M CGs in the scanning order, and remaining CGs.        -   i. In one example, M is set to 1.        -   ii. In one example, M is set to 2 for 4×N and N×4 (N>8)            blocks; and set to 1 for all the other cases.    -   b. In one example, the block is treated to be two parts,        sub-regions where RST is applied, and sub-regions where RST is        not applied.        -   i. If RST4×4 is applied, the RST applied sub-region is the            first one or two CGs of the current block.        -   ii. If RST4×4 is applied, the RST applied sub-region is the            first three CGs of the current block.    -   c. In one example, it is proposed to disable the usage of        previously coded information in the context modeling process for        the first part within one block but enable it for the second        part.    -   d. In one example, when decoding the first CG, the information        of the remaining one or multiple CGs may be disallowed to be        used.        -   i. In one example, when coding the CG coded block flag for            the first CG, the value of the second CG (e.g., right or            below) is not taken into consideration.        -   ii. In one example, when coding the CG coded block flag for            the first CG, the value of the second and third CG (e.g.,            right and below CGs for W×H (W>=8 and H>=8)) is not taken            into consideration.        -   iii. In one example, when coding the current coefficient, if            its neighbor in the context template is in a different CG,            the information from this neighbor is disallowed to be used.    -   e. In one example, when decoding coefficients in the RST applied        region, the information of the rest region that RST is not        applied to may be disallowed to be used.    -   f. Alternatively, furthermore, the above methods may be applied        under certain conditions.        -   i. The condition may include whether RST is enabled or not.        -   ii. The condition may include the block dimension.

Context Modeling in Arithmetic Coding of RST Side Information

11. When coding the RST index, the context modeling may depend onwhether explicit or implicit multiple transform selection (MTS) isenabled.

-   -   a. In one example, when implicit MTS is enabled, different        contexts may be selected for blocks coded with same intra        prediction modes.        -   i. In one example, the block dimensions such as shape            (square or non-square) is used to select the context.    -   b. In one example, instead of checking the transform index (e.g,        tu_mts_idx) coded for the explicit MTS, the transform matrix        basis may be used instead.        -   i. In one example, for transform matrix basis with DCT-II            for both horizontal and vertical 1-D transforms, the            corresponding context may be different from other kinds of            transform matrices.

12. When coding the RST index, the context modeling may depend onwhether CCLM is enabled or not (e.g., sps_cclm_enabled_flag).

-   -   a. Alternatively, whether to enable or how to select the context        for RST index coding may depend on whether CCLM is applied to        one block.    -   b. In one example, the context modeling may depend on whether        CCLM is enabled for current block.        -   i. In one example, the intraModeCtx=sps_cclm_enabled_flag?            (intra_chroma_pred_mode[×0][y0] is CCLM:            intra_chroma_pred_mode[×0][y0] is DM)?1:0.    -   c. Alternatively, whether to enable or how to select the context        for RST index coding may depend on whether the current chroma        block is coded with the DM mode.        -   i. In one example, the            intraModeCtx=(intra_chroma_pred_mode[×0][y0]==(sps_cclm_enabled_flag?            7:4))?1:0.

13. When coding the RST index, the context modeling may depend on theblock dimension/splitting depth (e.g., quadtree depth and/or BT/TTdepth).

14. When coding the RST index, the context modeling may depend on thecolor formats and/or color components.

15. When coding the RST index, the context modeling may be independentfrom the intra prediction modes, and/or the MTS index.

16. When coding the RST index, the first and/or second bin may becontext coded with only one context; or bypass coded.

Invoking RST Process Under Conditions

17. Whether to invoke the inverse RST process may depend on the CG codedblock flags.

-   -   a. In one example, if the top-left CG coded block flag is zero,        there is no need invoke the process.        -   i. In one example, if the top-left CG coded block flag is            zero and the block size is unequal to 4×N/N×4 (N>8), there            is no need invoke the process.    -   b. In one example, if the first two CG coded block flags in the        scanning order are both equal to zero, there is no need invoke        the process.        -   i. In one example, if the first two CG coded block flags in            the scanning order are both equal to zero and the block size            is equal to 4×N/N×4 (N>8), there is no need invoke the            process.

18. Whether to invoke the inverse RST process may depend on blockdimension.

-   -   a. In one example, for certain block dimensions, such as        4×8/8×4, RST may be disabled. Alternatively, furthermore,        signaling of RST related syntax elements may be skipped.

Example Implementations of the Disclosed Technology

In the following exemplary embodiments, the changes on top of JVET-N0193are highlighted in bold and italic. Deleted texts are marked with doublebrackets (e.g., [[a]] denotes the deletion of the character “a”).

Embodiment #1

Signaling of RST index is dependent on number of non-zero coefficientswithin a sub-region of the block, instead of the whole block.

7.3.6.11 Residual Coding Syntax

Descriptor residual_coding( x0, y0, log2TbWidth, log2TbHeight, cIdx ) { if( ( tu_mts_idx[ x0 ][ y0 ] > 0 | |   ( cu_sbt_flag && log2TbWidth < 6&& log2TbHeight < 6 ) )   && cIdx = = 0 && log2TbWidth > 4 )  log2TbWidth = 4  else   log2TbWidth = Min( log2TbWidth, 5)  if(tu_mts_idx[ x0 ][ y0 ] > 0 | |   ( cu_sbt_flag && log2TbWidth < 6 &&log2TbHeight < 6 ) )   && cIdx = = 0 && log2TbHeight > 4 )  log2TbHeight = 4  else   log2TbHeight = Min( log2TbHeight, 5)  if(log2TbWidth > 0 )   last_sig_coeff_x_prefix ae(v)  if( log2TbHeight > 0)   last_sig_coeff_y_prefix ae(v)  if( last_sig_coeff_x_prefix > 3 )  last_sig_coeff_x_suffix ae(v)  if( last_sig_coeff_y_prefix > 3 )  last_sig_coeff_y_suffix ae(v)  log2SbW = ( Min( log2TbWidth,log2TbHeight ) < 2 ? 1 : 2 )  log2SbH = log2SbW  if ( log2TbWidth < 2 &&cIdx = = 0 ) {   log2SbW = log2TbWidth   log2SbH = 4 − log2SbW  } elseif ( log2TbHeight < 2 && cIdx = = 0 ) {   log2SbH = log2TbHeight  log2SbW = 4 − log2SbH  }  numSbCoeff = 1 << ( log2SbW + log2SbH ) lastScanPos = numSbCoeff  lastSubBlock = ( 1 << ( log2TbWidth +log2TbHeight − ( log2SbW + log2SbH ) ) ) − 1  do {   if( lastScanPos = =0 ) {    lastScanPos = numSbCoeff    lastSubBlock− −   }   lastScanPos−−   xS = DiagScanOrder[ log2TbWidth − log2SbW ][ log2TbHeight − log2SbH]        [ lastSubBlock ][ 0 ]   yS = DiagScanOrder[ log2TbWidth −log2SbW ][ log2TbHeight − log2SbH ]        [ lastSubBlock ][ 1 ]   xC =( xS << log2SbW ) + DiagScanOrder[ log2SbW ][ log2SbH ][ lastScanPos ][0 ]   yC = ( yS << log2SbH ) + DiagScanOrder[ log2SbW ][ log2SbH ][lastScanPos ][ 1 ]   } while( ( xC != LastSignificantCoeffX ) | | ( yC!= LastSignificantCoeffY ) )   QState = 0   for( i = lastSubBlock; i >=0; i− − ) {   startQStateSb = QState   xS = DiagScanOrder[ log2TbWidth −log2SbW ][ log2TbHeight − log2SbH ]        [ lastSubBlock ][ 0 ]   yS =DiagScanOrder[ log2TbWidth − log2SbW ][ log2TbHeight − log2SbH ]       [ lastSubBlock ][ 1 ]   inferSbDcSigCoeffFlag = 0   if( ( i <lastSubBlock ) && ( i > 0 ) ) {    coded_sub_block_flag[ xS ][ yS ]ae(v)    inferSbDcSigCoeffFlag = 1   }   firstSigScanPosSb = numSbCoeff  lastSigScanPosSb = −1   remBinsPass1 = ( ( log2SbW + log2SbH ) < 4 ? 8: 32 )   firstPosMode0 = ( i = = lastSubBlock ? lastScanPos : numSbCoeff− 1 )   firstPosMode1 = − 1   for( n = firstPosMode0; n >= 0 &&remBinsPass1 >= 4; n− − ) {    xC = ( xS << log2SbW ) + DiagScanOrder[log2SbW ][ log2SbH ][ n ][ 0 ]    yC = ( yS << log2SbH ) +DiagScanOrder[ log2SbW ][ log2SbH ][ n ][ 1 ]    if(coded_sub_block_flag[ xS ][ yS ] && ( n > 0 | | !inferSbDcSigCoeffFlag )&&     ( xC != LastSignificantCoeffX | | yC != Last SignificantCoeffY )) {     sig_coeff_flag[ xC ][ yC ] ae(v)     remBinsPass1− −     if(sig_coeff_flag[ xC ][ yC ] )      inferSbDcSigCoeffFlag = 0    }    if(sig_coeff_flag[ xC ][ yC ] ) {     if( !transform_skip_flag[ x0 ][ y0 ]) {      if ( i = 0 || (i == 1 && (log2TbWidth + log2TbHeight ==5)) )      numSigCoeff++      if( ( ( ( log2TbWidth == 2 && log2TbHeight == 2) | | ( log2TbWidth == 3 &&       log2TbHeight == 3 ) ) && n >= 8 && i== 0 ) | | ( ( log2TbWidth >= 3 &&        log2TbHeight >=3 && ( i == 1 || i == 2 ) ) ) ) {      numZeroOutSigCoeff++      }     }    abs_level_gt1_flag[ n ] ae(v)     remBinsPass1− −     if(abs_level_gt1_flag[ n ] ) {      par_level_flag[ n ] ae(v)     remBinsPass1− −      abs_level_gt3_flag[ n ] ae(v)     remBinsPass1− −     }     if( lastSigScanPosSb = = −1 )     lastSigScanPosSb = n     firstSigScanPosSb = n    } ...   } }Alternatively, the condition may be replaced by:

if (i=0[[∥(i==1&&(log 2TbWidth+log 2TbHeight==5))]])

Embodiment #2

RST may not be invoked according to coded block flags of certain CGs.

8.7.4. Transformation Process for Scaled Transform Coefficients

8.7.4.1 General

Inputs to this process are:

-   -   a luma location (xTbY, yTbY) specifying the top-left sample of        the current luma transform block relative to the top-left luma        sample of the current picture,    -   a variable nTbW specifying the width of the current transform        block,    -   a variable nTbH specifying the height of the current transform        block,    -   a variable cIdx specifying the colour component of the current        block,    -   an (nTbW)×(nTbH) array d[x][y] of scaled transform coefficients        with x=0 . . . nTbW−1, y=0 . . . nTbH−1.        Output of this process is the (nTbW)×(nTbH) array r[x][y] of        residual samples with x=0 . . . nTbW−1, y=0 . . . nTbH−1.        A variable bInvokeST is set to 0, and further modified to be 1        if one of the following conditions is true:    -   if coded_sub_block_flag[0][0] is equal to 1 and nTbW×nTbH !=32    -   if coded_sub_block_flag[0][0] and coded_sub_block_flag[0][1] is        equal to 1 and nTbW is equal to 4 and nTbH is greater than 8    -   if coded_sub_block_flag[0][0] and coded_sub_block_flag[0][0] is        equal to 1 and nTbW is greater than 8 and nTbH is equal to 4        If bInvokeST is equal to 1 and st_idx[xTbY][yTbY] is not equal        to 0, the following applies:

1. The variables nStSize, log 2StSize, numStX, numStY, and nonZeroSizeare derived as follows:

-   -   If both nTbW and nTbH are greater than or equal to 8, log        2StSize is set to 3 and nStOutSize is set to 48.    -   Otherwise, log 2StSize is set to 2 and nStOutSize is set to 16.    -   nStSize is set to (1<<log 2StSize).    -   If nTbH is equal to 4 and nTbW is greater than 8, numStX set        equal to 2.    -   Otherwise, numStX set equal to 1.    -   If nTbW is equal to 4 and nTbH is greater than 8, numStY set        equal to 2.    -   Otherwise, numStY set equal to 1.    -   If both nTbW and nTbH are equal to 4 or both nTbW and nTbH are        equal to 8, nonZeroSize is set equal to 8.    -   Otherwise, nonZeroSize set equal to 16.

2. For xSbIdx=0 . . . numStX−1 and ySbIdx=0 . . . numStY−1, thefollowing applies:

-   -   The variable array u[x] with x=0 . . . nonZeroSize−1 are derived        as follows:

xC=(xSbIdx<< log 2StSize)+DiagScanOrder[log 2StSize][log 2StSize][x][0]

yC=(ySbIdx<< log 2StSize)+DiagScanOrder[log 2StSize][log 2StSize][x][1]

u[x]=d[xC][yC]

-   -   u[x] with x=0 . . . nonZeroSize−1 is transformed to the variable        array v[x] with x=0 . . . nStOutSize−1 by invoking the        one-dimensional transformation process as specified in clause        8.7.4.4 with the transform input length of the scaled transform        coefficients nonZeroSize, the transform output length nStOutSize        the list u[x] with x=0 . . . nonZeroSize−1, the index for        transform set selection stPredModeIntra, and the index for        transform selection in a transform set st_idx[xTbY][yTbY] as        inputs, and the output is the list v[x] with x=0 . . .        nStOutSize−1. The variable stPredModeIntra is set to the        predModeIntra specified in clause 8.4.4.2.1.    -   The array d[(xSbIdx<<log 2StSize)+x][(ySbIdx<<log 2StSize)+y]        with x=0 . . . nStSize−1, y=0 . . . nStSize−1 are derived as        follows:        -   If stPredModeIntra is less than or equal to 34, or equal to            INTRA_LT_CCLM, INTRA_T_CCLM, or INTRA_L_CCLM, the following            applies:

d[(xSbIdx<<log 2StSize)+x][(ySbIdx<<log 2StSize)+y]=(y<4)?v[x+(y<<log2StSize)]:((x<4)?v[32+x+((y−4)<<2)]:d[(xSbIdx<<log2StSize)+x][(ySbIdx<<log 2StSize)+y])

-   -   -   Otherwise, the following applies:

d[(xSbIdx<< log 2StSize)+x][(ySbIdx<< log 2StSize)+y]=(y<4)?v[y+(x<<log2StSize)]:((x<4)?v[32+(y−4)+(x<<2)]:d[(xSbIdx<<log2StSize)+x][(ySbIdx<<log 2StSize)+y])

The variable implicitMtsEnabled is derived as follows:

-   -   If sps_mts_enabled_flag is equal to 1 and one of the following        conditions is true, implicitMtsEnabled is set equal to 1:        -   IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT        -   cu_sbt_flag is equal to 1 and Max(nTbW, nTbH) is less than            or equal to 32        -   sps_explicit_mts_intra_enabled_flag and            sps_explicit_mts_inter_enabled_flag are both equal to 0 and            CuPredMode[xTbY][yTbY] is equal to MODE_INTRA    -   Otherwise, implicitMtsEnabled is set equal to 0.        The variable trTypeHor specifying the horizontal transform        kernel and the variable trTypeVer specifying the vertical        transform kernel are derived as follows:    -   If cIdx is greater than 0, trTypeHor and trTypeVer are set equal        to 0.    -   Otherwise, if implicitMtsEnabled is equal to 1, the following        applies:        -   If IntraSubPartitionsSplitType is not equal to ISP_NO_SPLIT,            trTypeHor and trTypeVer are specified in Table 8-15            depending on intraPredMode.        -   Otherwise, if cu_sbt_flag is equal to 1, trTypeHor and            trTypeVer are specified in Table 8-14 depending on            cu_sbt_horizontal_flag and cu_sbt_pos_flag.        -   Otherwise (sps_explicit_mts_intra_enabled_flag and            sps_explicit_mts_inter_enabled_flag are equal to 0),            trTypeHor and trTypeVer are derived as follows:

trTypeHor=(nTbW>=4&& nTbW<=16&& nTbW<=nTbH)?1:0  (8-1029)

trTypeVer=(nTbH>=4&& nTbH<=16&& nTbH<=nTbW)?1:0  (8-1030)

-   -   Otherwise, trTypeHor and trTypeVer are specified in Table 8-13        depending on tu_mts_idx[xTbY][yTbY].

The variables nonZeroW and nonZeroH are derived as follows:

nonZeroW=Min(nTbW,(trTypeHor>0)?16:32)  (8-1031)

nonZeroH=Min(nTbH,(trTypeVer>0)?16:32)  (8-1032)

The (nTbW)×(nTbH) array r of residual samples is derived as follows:1. When nTbH is greater than 1, each (vertical) column of scaledtransform coefficients d[x][y] with x=0 . . . nonZeroW−1, y=0 . . .nonZeroH−1 is transformed to e[x][y] with x=0 . . . nonZeroW−1, y=0 . .. nTbH−1 by invoking the one-dimensional transformation process asspecified in clause 8.7.4.2 for each column x=0 . . . nonZeroW−1 withthe height of the transform block nTbH, the non-zero height of thescaled transform coefficients nonZeroH, the list d[x][y] with y=0 . . .nonZeroH−1 and the transform type variable trType set equal to trTypeVeras inputs, and the output is the list e[x][y] with y=0 . . . nTbH−1.2. When nTbH and nTbW are both greater than 1, the intermediate samplevalues g[x][y] with x=0 . . . nonZeroW−1, y=0 . . . nTbH−1 are derivedas follows:

g[x][y=Clip3(CoeffMin,CoeffMax,(e[x][y+64)>>7)  (8-1033)

When nTbW is greater than 1, each (horizontal) row of the resultingarray g[x][y] with x=0 . . . nonZeroW−1, y=0 . . . nTbH−1 is transformedto x][y] with x=0 . . . nTbW−1, y=0 . . . nTbH−1 by invoking theone-dimensional transformation process as specified in clause 8.7.4.2for each row y=0 . . . nTbH−1 with the width of the transform blocknTbW, the non-zero width of the resulting array g[x][y] nonZeroW, thelist g[x][y] with x=0 . . . nonZeroW−1 and the transform type variabletrType set equal to trTypeHor as inputs, and the output is the listx][y] with x=0 . . . nTbW−1.

Embodiment #3

Context modeling of RST index is revised.

5.3.1 Alternative #1

9.5.4.2.8 Derivation Process of ctxInc for the Syntax Element St_Idx

Inputs to this process are the colour component index cIdx, the luma orchroma location (×0, y0) specifying the top-left sample of the currentluma or chroma coding block relative to the top-left sample of thecurrent picture depending on cIdx, the tree type treeType, the lumaintra prediction mode IntraPredModeY[×0][y0] as specified in clause8.4.2, the syntax element intra_chroma_pred_mode[×0][y0] specifying theintra prediction mode for chroma samples as specified in clause 7.4.7.5,the block width nTbW and height nTbH, and the multiple transformselection index tu_mts_idx[×0][y0].Output of this process is the variable ctxInc.The variable intraModeCtx is derived as follows:If cIdx is equal to 0, intraModeCtx is derived as follows:

intraModeCtx=(IntraPredModeY[×0][y0]<=1)?1:0

Otherwise (cIdx is greater than 0), intraModeCtx is derived as follows:

intraModeCtx=(intra_chroma_pred_mode[×0][y0]>=4)?1:0

The variable mtsCtx is derived as follows:

mtsCtx=((sps_explicit_mts_intra_enabled_flag?tu_mts_idx[×0][y0]==0:nTbW==nTbH)&&treeType!=SINGLE_TREE)?1:0

The variable ctxInc is derived as follows:ctxInc=(binIdx<<1)+intraModeCtx+(mtsCtx<<2)

5.3.2 Alternative #2

Syntax Binarization structure Syntax element Process Input parameters...... ....... ...... st_idx[ ][ ] TR cMax = 2, cRiceParam = 0

TABLE 9-15 Assignment of ctxInc to syntax elements with context codedbins binIdx Syntax element 0 1 2 3 4 >= 5 . . . . . . . . . . . . . . .. . . . . . st_idx[ ][ ] 0[[, 1, 4, 5]] 2[[, 3, 6, 7]] na na na na(clause 9.5.4.2.8) (clause 9.5.4.2.8) . . . . . . . . . . . . . . . . .. . . .

[[9.5.4.2.8 Derivation Process of ctxInc for the Syntax Element St_Idx

Inputs to this process are the colour component index cIdx, the luma orchroma location (×0, y0) specifying the top-left sample of the currentluma or chroma coding block relative to the top-left sample of thecurrent picture depending on cIdx, the tree type treeType, the lumaintra prediction mode IntraPredModeY[×0][y0] as specified in clause8.4.2, the syntax element intra_chroma_pred_mode[×0][y0] specifying theintra prediction mode for chroma samples as specified in clause 7.4.7.5,and the multiple transform selection index tu_mts_idx[×0][y0].

Output of this process is the variable ctxInc.

The variable intraModeCtx is derived as follows: If cIdx is equal to 0,intraModeCtx is derived as follows:

intraModeCtx=(IntraPredModeY[×0][y0]<=1)?1:0

Otherwise (cIdx is greater than 0), intraModeCtx is derived as follows:

intraModeCtx=(intra_chroma_pred_mode[×0][y0]>=4)?1:0

The variable mtsCtx is derived as follows:

mtsCtx=(tu_mts_idx[×0][y0]==0&& treeType!=SINGLE_TREE)?1:0

The variable ctxInc is derived as follows:

ctxInc=(binIdx<<1)+intraModeCtx+(mtsCtx<<2)

FIG. 22A is a block diagram of a video processing apparatus 2210. Theapparatus 2210 may be used to implement one or more of the methodsdescribed herein. The apparatus 2210 may be embodied in a smartphone,tablet, computer, Internet of Things (IoT) receiver, and so on. Theapparatus 2210 may include one or more processors 2212, one or morememories 2214 and video processing hardware 2216. The processor(s) 2212may be configured to implement one or more methods described in thepresent document. The memory (memories) 2214 may be used for storingdata and code used for implementing the methods and techniques describedherein. The video processing hardware 2216 may be used to implement, inhardware circuitry, some techniques described in the present document.

FIG. 22B is another example of a block diagram of a video processingsystem in which disclosed techniques may be implemented. FIG. 22B is ablock diagram showing an example video processing system 2220 in whichvarious techniques disclosed herein may be implemented. Variousimplementations may include some or all of the components of the system2220. The system 2220 may include input 2222 for receiving videocontent. The video content may be received in a raw or uncompressedformat, e.g., 8 or 10 bit multi-component pixel values, or may be in acompressed or encoded format. The input 2222 may represent a networkinterface, a peripheral bus interface, or a storage interface. Examplesof network interface include wired interfaces such as Ethernet, passiveoptical network (PON), etc. and wireless interfaces such as Wi-Fi orcellular interfaces.

The system 2220 may include a coding component 2224 that may implementthe various coding or encoding methods described in the presentdocument. The coding component 2224 may reduce the average bitrate ofvideo from the input 2222 to the output of the coding component 2224 toproduce a coded representation of the video. The coding techniques aretherefore sometimes called video compression or video transcodingtechniques. The output of the coding component 2224 may be eitherstored, or transmitted via a communication connected, as represented bythe component 2226. The stored or communicated bitstream (or coded)representation of the video received at the input 2222 may be used bythe component 2228 for generating pixel values or displayable video thatis sent to a display interface 2229. The process of generatinguser-viewable video from the bitstream representation is sometimescalled video decompression. Furthermore, while certain video processingoperations are referred to as “coding” operations or tools, it will beappreciated that the coding tools or operations are used at an encoderand corresponding decoding tools or operations that reverse the resultsof the coding will be performed by a decoder.

Examples of a peripheral bus interface or a display interface mayinclude universal serial bus (USB) or high definition multimediainterface (HDMI) or Displayport, and so on. Examples of storageinterfaces include SATA (serial advanced technology attachment), PCI,IDE interface, and the like. The techniques described in the presentdocument may be embodied in various electronic devices such as mobilephones, laptops, smartphones or other devices that are capable ofperforming digital data processing and/or video display.

The examples described above may be incorporated in the context of themethods described below, e.g., methods 2310 and 2320, which may beimplemented at a video decoder or a video encoder.

FIG. 23A shows a flowchart of an exemplary method for video processing.The method 2310 includes, at step 2312, performing a conversationbetween a current video block of a video and a coded representation ofthe video. In some implementations, the secondary transform toolincludes, applying during encoding, a forward secondary transform to anoutput of a forward primary transform applied to a residual of thecurrent video block prior to quantization, or applying, during decoding,an inverse secondary transform to an output of dequantization of thecurrent video block before applying an inverse primary transform.

In some implementations, the conversion comprises: selecting, for thecurrent video block of a video, a transform set or a transform matrix tobe used in an application of a secondary transform tool to the currentvideo block based on a characteristic of the current video block; andapplying the selected transform set or transform matrix to the currentvideo block. In some implementations, the conversion comprises applyinga secondary transform tool to a sub-region of the current video blockthat is not a top-left part of the current video block.

In some implementations, the coded representation conforms to a formatrule that specifies a last non-zero coefficient in a residual of thecurrent video block and controls whether or how side information about asecondary transform tool is included in the coded representation. Insome implementations, the coded representation conforms to a format rulethat specifies one or more coefficients in a residual of a portion ofthe current video block and controls whether or how side informationabout a secondary transform tool is included in the codedrepresentation. In some implementations, the performing of theconversion includes determining an applicability of a secondarytransform tool to the current video block based on a presence of anon-zero coefficient in one or more coding groups of the current videoblock.

In some implementations, the coded representation conforms to a formatrule specifying that a syntax element corresponding to side informationof a secondary transform tool for the current video block is signaled inthe coded representation before transform related information. In someimplementations, the coded representation conforms to a format rulespecifying that a syntax element corresponding to side information of asecondary transform tool for the current video block is signaled in thecoded representation before residual coding information. In someimplementations, the performing of the conversion includes coding aresidual of the current video block according to a rule based oninformation related to the secondary transform tool. In someimplementations, the performing of the conversion includes applying, toone or more portions of the current video block, an arithmetic codingusing different context modeling methods according to a rule.

In some implementations, the performing of the conversion includesconfiguring, based on a characteristic of the current video block of avideo, a context model for coding a bin or bypass coding the bin of abin string corresponding to an index of a secondary transform tool, andthe index indicates an applicability of the secondary transform tooland/or a kernel information of the secondary transform tool. In someimplementations, the performing of the conversion includes determining,based on a dimension of the current video block, whether a syntaxelement is included in the coded representation. In someimplementations, the syntax element corresponds to side information of asecondary transform tool which comprises at least one of indication ofapplying the secondary transform and an index of the transform kernelsused in a secondary transform process.

FIG. 23B shows a flowchart of an exemplary method for video processing.The method 2320 includes, at step 2322, determining, for a conversionbetween a current video block of a current picture of a video and acoded representation of the video, an applicability of a secondarytransform tool for the current video block due to a rule that is relatedto an intra prediction direction being used for coding the current videoblock, a use of a coding tool, and/or a color component of the videothat the current video block is from. The method 2320 further includes,at step 2324, performing the conversion based on the determining.

In some embodiments, the video coding methods may be implemented usingan apparatus that is implemented on a hardware platform as describedwith respect to FIG. 23A or 23B.

Some embodiments of the disclosed technology include making a decisionor determination to enable a video processing tool or mode. In anexample, when the video processing tool or mode is enabled, the encoderwill use or implement the tool or mode in the processing of a block ofvideo, but may not necessarily modify the resulting bitstream based onthe usage of the tool or mode. That is, a conversion from the block ofvideo to the bitstream representation of the video will use the videoprocessing tool or mode when it is enabled based on the decision ordetermination. In another example, when the video processing tool ormode is enabled, the decoder will process the bitstream with theknowledge that the bitstream has been modified based on the videoprocessing tool or mode. That is, a conversion from the bitstreamrepresentation of the video to the block of video will be performedusing the video processing tool or mode that was enabled based on thedecision or determination.

Some embodiments of the disclosed technology include making a decisionor determination to disable a video processing tool or mode. In anexample, when the video processing tool or mode is disabled, the encoderwill not use the tool or mode in the conversion of the block of video tothe bitstream representation of the video. In another example, when thevideo processing tool or mode is disabled, the decoder will process thebitstream with the knowledge that the bitstream has not been modifiedusing the video processing tool or mode that was disabled based on thedecision or determination.

In the present document, the term “video processing” may refer to videoencoding, video decoding, video compression or video decompression. Forexample, video compression algorithms may be applied during conversionfrom pixel representation of a video to a corresponding bitstreamrepresentation or vice versa. The bitstream representation of a currentvideo block may, for example, correspond to bits that are eitherco-located or spread in different places within the bitstream, as isdefined by the syntax. For example, a block may be encoded in terms oftransformed and coded error residual values and also using bits inheaders and other fields in the bitstream. Herein, a block maycorrespond to a grouping of samples or pixels for an operation, e.g., acoding unit or a transform unit or a prediction unit, and so on.

Various techniques and embodiments may be described using the followingclause-based format. In the followings, the secondary transform tool canbe used that, during encoding, a forward secondary transform is appliedto an output of a forward primary transform applied to a residual of thecurrent video block prior to quantization, or, during decoding, aninverse secondary transform is applied to an output of dequantization ofthe current video block before applying an inverse primary transform.The secondary transform tool is applicable to the block between aforward primary transform and a quantization step or between ade-quantization step and an inverse primary transform, and wherein thereduced dimension corresponding to the sub-block that is reduced from adimension of the block. In some implementations, the secondary transformtool corresponds to a low frequency non-separable transform (LFNST)tool.

The first set of clauses describe certain features and aspects of thedisclosed techniques in the previous section.

1. A method for video processing, comprising: selecting, based on acharacteristic of a current video block, a transform set or a transformmatrix for an application of a reduced secondary transform to thecurrent video block; and applying, as part of a conversion between thecurrent video block and a bitstream representation of a video comprisingthe current video block, the selected transform set or transform matrixto a portion of the current video block.

2. The method of clause 1, wherein the portion of the current videoblock is a top-right sub-region, bottom-right sub-region, bottom-leftsub-region or center sub-region of the current video block.

3. The method of clause 1 or 2, wherein the characteristic of thecurrent video block is an intra prediction mode or a primary transformmatrix of the current video block.

4. The method of clause 1, wherein the characteristic is a colorcomponent of the current video block.

5. The method of clause 4, wherein a first transform set is selected fora luma component of the current video block, and wherein a secondtransform set different from the first transform set is selected for oneor more chroma components of the current video block.

6. The method of clause 1, wherein the characteristic is an intraprediction mode or an intra coding method of the current video block.

7. The method of clause 6, wherein the intra prediction method comprisesa multiple reference line (MRL)-based prediction method or amatrix-based intra prediction method.

8. The method of clause 6, wherein a first transform set is selectedwhen the current video block is a cross-component linear model (CCLM)coded block, and wherein a second transform set different from the firsttransform set is selected when the current video block is a non-CCLMcoded block.

9. The method of clause 6, wherein a first transform set is selectedwhen the current video block is coded with a joint chroma residualcoding method, and wherein a second transform set different from thefirst transform set is selected when the current video block is notcoded with the joint chroma residual coding method.

10. The method of clause 1, wherein the characteristic is a primarytransform of the current video block.

11. A method for video processing, comprising: making a decision, basedon one or more coefficients associated with a current video block,regarding a selective inclusion of signaling of side information for anapplication of a reduced secondary transform (RST) in a bitstreamrepresentation of the current video block; and performing, based on thedecision, a conversion between the current video block and a videocomprising the bitstream representation of the current video block.

12. The method of clause 11, wherein the one or more coefficientscomprises a last non-zero coefficient in a scanning order of the currentvideo block.

13. The method of clause 11, wherein the one or more coefficientscomprises a plurality of coefficients within a partial region of thecurrent video block.

14. The method of clause 13, wherein the partial region comprises one ormore coding groups that the RST could be applied to.

15. The method of clause 13, wherein the partial region comprises afirst M coding groups or a last M coding groups in a scanning order ofthe current video block.

16. The method of clause 13, wherein the partial region comprises afirst M coding groups or a last M coding groups in a reverse scanningorder of the current video block.

17. The method of clause 13, wherein making the decision is furtherbased on an energy of one or more non-zero coefficients of the pluralityof coefficients.

18. A method for video processing, comprising: configuring, for anapplication of a reduced secondary transform (RST) to a current videoblock, a bitstream representation of the current video block, wherein asyntax element related to the RST is signaled in the bitstreamrepresentation before coding residual information; and performing, basedon the configuring, a conversion between the current video block and thebitstream representation of the current video block.

19. The method of clause 18, wherein signaling the syntax elementrelated to the RST is based on at least one coded block flag or a usageof a transform selection mode.

20. The method of clause 18, wherein the bitstream representationexcludes the coding residual information corresponding to coding groupswith all zero coefficients.

21. The method of clause 18, wherein the coding residual information isbased on the application of the RST.

22. A method for video processing, comprising: configuring, for anapplication of a reduced secondary transform (RST) to a current videoblock, a bitstream representation of the current video block, wherein asyntax element related to the RST is signaled in the bitstreamrepresentation before either a transform skip indication or a multipletransform set (MTS) index; and performing, based on the configuring, aconversion between the current video block and the bitstreamrepresentation of the current video block.

23. The method of clause 22, wherein the transform skip indication orthe MTS index is based on the syntax element related to the RST.

24. A method for video processing, comprising: configuring, based on acharacteristic of a current video block, a context model for coding anindex of a reduced secondary transform (RST); and performing, based onthe configuring, a conversion between the current video block and abitstream representation of a video comprising the current video block.

25. The method of clause 24, wherein the characteristic is an explicitor implicit enablement of a multiple transform selection (MTS) process.

26. The method of clause 24, wherein the characteristic is an enablementof a cross-component linear model (CCLM) coding mode in the currentvideo block.

27. The method of clause 24, wherein the characteristic is a size of thecurrent video block.

28. The method of clause 24, wherein the characteristic is a splittingdepth of a partitioning process applied to the current video block.

29. The method of clause 28, wherein the partitioning process is aquadtree (QT) partitioning process, a binary tree (BT) partitioningprocess or a ternary tree (TT) partitioning process.

30. The method of clause 24, wherein the characteristic is a colorformat or a color component of the current video block.

31. The method of clause 24, wherein the characteristic excludes anintra prediction mode of the current video block and an index of amultiple transform selection (MTS) process.

32. A method for video processing, comprising: making a decision, basedon a characteristic of a current video block, regarding a selectiveapplication of an inverse reduced secondary transform (RST) process onthe current video block; and performing, based on the decision, aconversion between the current video block and a bitstreamrepresentation of a video comprising the current video block.

33. The method of clause 32, wherein the characteristic is a coded blockflag of a coding group of the current video block.

34. The method of clause 33, wherein the inverse RST process is notapplied, and wherein the coded block flag of a top-left coding group iszero.

35. The method of clause 33, wherein the inverse RST process is notapplied, and wherein coded block flags for a first and a second codinggroup in a scanning order of the current video block are zero.

36. The method of clause 32, wherein the characteristic is a height (M)or a width (N) of the current video block.

37. The method of clause 36, wherein the inverse RST process is notapplied, and wherein (i) M=8 and N=4, or (ii) M=4 and N=8.

38. An apparatus in a video system comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor, cause the processor toimplement the method in any one of clauses 1 to 37.

39. A computer program product stored on a non-transitory computerreadable media, the computer program product including program code forcarrying out the method in any one of clauses 1 to 37.

The second set of clauses describe certain features and aspects of thedisclosed techniques in the previous section, for examples, ExampleImplementations 1-4.

1. A video processing method, comprising: performing a conversationbetween a current video block of a video and a coded representation ofthe video, wherein the conversion comprises:

selecting, for the current video block of a video, a transform set or atransform matrix to be used in an application of a secondary transformtool to the current video block based on a characteristic of the currentvideo block; and applying the selected transform set or transform matrixto the current video block, and wherein, using the secondary transformtool: during encoding, a forward secondary transform is applied to anoutput of a forward primary transform applied to a residual of thecurrent video block prior to quantization, or during decoding, aninverse secondary transform is applied to an output of dequantization ofthe current video block before applying an inverse primary transform.

2. The method of clause 1, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

3. The method of clause 1 or 2, wherein the characteristic is a colorcomponent of the current video block.

4. The method of clause 3, wherein a first transform set is selected fora luma component of the current video block, and a second transform setdifferent from the first transform set is selected for one or morechroma components of the current video block.

5. The method of clause 3, wherein each color component of the currentvideo block corresponds to one transform set.

6. The method of clause 3, wherein, for different color components ofthe current video block, multiple sets of transform matrix are selectedsuch that one of the multiple sets includes at least one transformmatrix that is different from matrices of remaining sets.

7. The method of clause 1, wherein the characteristic is an intraprediction method of the current video block.

8. The method of clause 7, wherein the intra prediction method of thecurrent video block includes a cross-component linear model (CCLM) or amatrix-based intra prediction method (MIP) mode, wherein the CCLM uses alinear mode to derive prediction values of a chroma component of thecurrent video block, and wherein the MIP mode includes determiningprediction values of the current video block by performing, onpreviously coded samples of the video, a boundary downsamplingoperation, followed by a matrix vector multiplication operation, andselectively followed by an upsampling operation.

9. The method of clause 7, wherein the selecting of the transform set orthe transform matrix is according to a rule based on use ofcross-component linear model (CCLM) that uses a linear mode to deriveprediction values of a chroma component of the current video block.

10. The method of clause 7, wherein the selecting of the transform setor the transform matrix is according to a rule based on use of a singleor multiple reference lines in a prediction mode of the current videoblock.

11. The method of clause 7, wherein the selecting of the transform setor the transform matrix is according to a rule based on use of a jointchroma residual coding of the current video block.

12. The method of clause 1, wherein the characteristic is a type of theforward primary transform or a type of the inverses primary transform ofthe current video block.

13. The method of clause 12, wherein the forward primary transform orthe inverse primary transform is an identity transform and wherein thetransform set and/or the transform matrix used in the application of thesecondary transform tool is different from metrices used in the forwardprimary transform or the inverse primary transform.

14. The method of clause 12, wherein the forward primary transform orthe inverse primary transform is performed with a horizontal 1Dtransform and a vertical 1-D transform that are with a same basisfunction and wherein the transform set and/or the transform matrix usedin the application of the secondary transform tool is different basisfunctions of a vertical and horizontal transforms used in the forwardprimary transform or the inverse primary transform.

15. The method of any of clauses 1 to 14, wherein the performing of theconversion includes generating the coded representation from the currentvideo block or generating the current video block from the codedrepresentation.

16. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the conversion comprises applying a secondarytransform tool to a sub-region of the current video block that is not atop-left part of the current video block, and wherein, using thesecondary transform tool: during encoding, a forward secondary transformis applied to an output of a forward primary transform applied to aresidual of the sub-region of the current video block prior toquantization, or during decoding, an inverse secondary transform isapplied to an output of dequantization of the sub-region of the currentvideo block before applying an inverse primary transform.

17. The method of clause 16, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

18. The method of clause 16, wherein the sub-region of the current videoblock corresponds to a top right, a bottom right, a bottom left, or acenter of the current video block.

19. The method of clause 16, wherein the sub-region is determined basedon an intra prediction mode or a primary transform matrix of the currentvideo block.

20. The method of any of clauses 16 to 19, wherein the performing of theconversion includes generating the coded representation from the currentvideo block or generating the current video block from the codedrepresentation.

21. A video processing method, comprising: determining, for a conversionbetween a current video block of a current picture of a video and acoded representation of the video, an applicability of a secondarytransform tool for the current video block due to a rule that is relatedto an intra prediction direction being used for coding the current videoblock, a use of a coding tool, and/or a color component of the videothat the current video block is from; and performing the conversionbased on the determining.

22. The method of clause 21, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

23. The method of clause 21, wherein the determining determines that thesecondary transform tool is applied to the current video block, andwherein, using the secondary transform tool: during encoding, a forwardsecondary transform is applied to an output of a forward primarytransform applied to a residual of the current video block prior toquantization; or during decoding, an inverse secondary transform isapplied to an output of dequantization of the current video block beforeapplying an inverse primary transform.

24. The method of clause 21, wherein the determining determines that thesecondary transform tool is not applied to the current video block, andwherein, during encoding, none of forward secondary transforms isapplied to an output of a forward primary transform applied to aresidual of the current video block prior to quantization; or wherein,during decoding, an inverse secondary transform to an output ofdequantization of the current video block before applying an inverseprimary transform is omitted.

25. The method of clause 21, wherein the coding tool corresponds to across-component linear model (CCLM) or a joint chroma residual coding.

26. The method of clause 21, wherein the color component corresponds toa chroma component of the current video block.

27. The method of clause 21, wherein the determining determines that thesecondary transform tool is not applied to the current video block in acase that the color component corresponds to a chroma component.

28. The method of clause 21, wherein the coding tool corresponds to anintra prediction method.

29. The method of any of clauses 21 to 28, wherein the performing of theconversion includes generating the coded representation from the currentvideo block or generating the current video block from the codedrepresentation.

30. An apparatus in a video system comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor, cause the processor toimplement the method in any one of clauses 1 to 29.

31. A computer program product stored on a non-transitory computerreadable media, the computer program product including program code forcarrying out the method in any one of clauses 1 to 29.

The third set of clauses describe certain features and aspects of thedisclosed techniques in the previous section, for examples, ExampleImplementations 5-7.

1. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the coded representation conforms to a format rulethat specifies a last non-zero coefficient in a residual of the currentvideo block and controls whether or how side information about asecondary transform tool is included in the coded representation, andwherein the secondary transform tool includes applying, during encoding,a forward secondary transform to an output of a forward primarytransform applied to a residual of a video block prior to quantization,or applying, during decoding, an inverse secondary transform to anoutput of dequantization of the video block before applying an inverseprimary transform.

2. The method of clause 1, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

3. The method of clause 1, wherein the format rule specifies the lastnon-zero coefficient in a scanning order of the current video block.

4. The method of clause 1, wherein the format rule controls to performsignaling the side information of the LFNST tool in a case that the lastnon-zero coefficient is located in a coding group of the current videoblock to which the secondary transform tool is applied.

5. The method of clause 1, wherein the format rule controls to skip thesignaling of the side information in a case that the last non-zerocoefficient is not located in a coding group of the current video blockto which that the secondary transform tool is applied to.

6. The method of clause 1, wherein the side information comprises atleast one of indication of applying the secondary transform tool, indexof the transform kernels used in the secondary transform tool.

7. The method of clause 1, wherein the secondary transform tool isdisabled for the current video block in a case the side information ofthe transform is not included in the coded representation.

8. The method of any of clauses 1 to 7, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

9. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the coded representation conforms to a format rulethat specifies one or more coefficients in a residual of a portion ofthe current video block and controls whether or how side informationabout a secondary transform tool is included in the codedrepresentation, and wherein the secondary transform tool includesapplying, during encoding, a forward secondary transform to an output ofa forward primary transform applied to a residual of a video block priorto quantization, or applying, during decoding, an inverse secondarytransform to an output of dequantization to the video block beforeapplying an inverse primary transform.

10. The method of clause 9, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

11. The method of clause 9, wherein the format rule defines the portionas one or more coding groups to which the secondary transform tool isapplied to.

12. The method of clause 9, wherein the format rule defines the portionas first M coding groups or last M coding groups of the current videoblock in a scanning order or reverse scanning order.

13. The method of clause 12, wherein M depends on a dimeson of thecurrent video block.

14. The method of clause 12, wherein M is 2 in a case that a size of thecurrent video block is 4×N and/or N×4, whereby N is an integer greaterthan 8.

15. The method of clause 12, wherein M is 1 in a case that a size of thecurrent video block is 4×8 and/or 8×4 and/or W×H, whereby W and H areintegers equal to or greater than 8.

16. The method of clause 9, wherein the format rule is based on aposition of the one or more coefficients within the portion.

17. The method of clause 9, wherein the format rule is based on anenergy of one or more non-zero coefficients within the portion.

18. The method of clause 9, wherein the format rule is based on a numberof the one or more coefficients within the portion.

19. The method of clause 18, wherein the format rule controls to skipthe signaling of the side information in a case that a number of the oneor more coefficients within the portion is less than a threshold.

20. The method of clause 19, wherein the threshold is based on slicetype, a picture type, a partition tree type, or video content.

21. The method of clause 19, wherein the threshold is based on a colorformat and/or a color component of the current video block.

22. The method of clause 9, wherein the side information comprises atleast one of indication of applying the secondary transform tool, indexof the transform kernels used in the secondary transform tool.

23. The method of clause 9, wherein the secondary transform tool isdisabled for the current video block in a case the side information ofthe transform is not included in the coded representation.

24. The method of any of clauses 9 to 23, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

25. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the performing of the conversion includes determiningan applicability of a secondary transform tool to the current videoblock based on a presence of a non-zero coefficient in one or morecoding groups of the current video block, and wherein the secondarytransform tool includes applying, during encoding, a forward secondarytransform to an output of a forward primary transform applied to aresidual of a video block prior to quantization, or applying, duringdecoding, an inverse secondary transform to an output of dequantizationof the video block before applying an inverse primary transform.

26. The method of clause 25, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

27. The method of clause 25, wherein the determining determines to applythe secondary transform tool in a case that at least one of the codinggroups contains at least one non-zero coefficient.

28. The method of clause 25, wherein, for the current video block havinga size of 4×N and/or N×4, the determining determines to enable thesecondary transform tool in a case that first two 4×4 coding groupscontain at least one non-zero coefficient, whereby N is an integergreater than 8.

29. The method of clause 25, wherein, for the current video block havinga size of 4×8 and/or 8×4, the determining determines to enable thesecondary transform tool in a case that top-left 4×4 coding groupscontain at least one non-zero coefficient.

30. The method of clause 25, wherein, for the current video block havinga size of W×H, the determining determines to enable the secondarytransform tool in a case that top-left 4×4 coding groups contain atleast one non-zero coefficient, whereby W and H are integers equal to orgreater than 8.

31. The method of clause 25, wherein the determining determines todisallow the LFNST tool in a case that there is no non-zero coefficientin the coding groups.

32. The method of clause 31, wherein, for the current video block havinga size of 4×N and/or N×4, the determining determines to disable thesecondary transform tool in a case that there is no non-zero coefficientin first two 4×4 coding groups, whereby N is an integer greater than 8.

33. The method of clause 31, wherein, for the current video block havinga size of 4×8 and/or 8×4, the determining determines to disable thesecondary transform tool in a case that there is no non-zero coefficientin a top-left 4×4 coding group.

34. The method of clause 31, wherein, for the current video block havinga size of W×H, the determining determines to disable the secondarytransform tool in a case that there is no non-zero coefficient in atop-left 4×4 coding group, whereby W and H are integers equal to orgreater than 8.

35. The method of clause 31, wherein, for the current video block havinga size of W×H, the determining determines to disable the secondarytransform tool in a case that there is no non-zero coefficient in atop-left 4×4 coding group, whereby W and H are integers equal to orgreater than 8.

36. The method of any of clauses 25 to 35, wherein side information ofthe secondary transform tool is not included in the coded representationin a case that the secondary transform tool is disabled for the currentvideo block.

37. The method of clause 36, wherein the side information comprises atleast one of indication of applying the secondary transform tool, indexof the transform kernels used in a secondary transform process.

38. The method of any of clauses 25 to 37, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

39. The method of any of clauses 1 to 38, wherein at least some blocksof the video are coded in the coded representation using the secondarytransform tool.

40. An apparatus in a video system comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor, cause the processor toimplement the method in any one of clauses 1 to 39.

41. A computer program product stored on a non-transitory computerreadable media, the computer program product including program code forcarrying out the method in any one of clauses 1 to 39.

The fourth set of clauses describe certain features and aspects of thedisclosed techniques in the previous section, for examples, ExampleImplementations 8-10.

1. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe current video block, wherein the coded representation conforms to aformat rule specifying that a syntax element corresponding to sideinformation of a secondary transform tool for the current video block issignaled in the coded representation before transform relatedinformation, wherein the secondary transform tool includes applying,during encoding, a forward secondary transform to an output of a forwardprimary transform applied to a residual of a video block prior toquantization, or applying, during decoding, an inverse secondarytransform to an output of dequantization of the video block beforeapplying an inverse primary transform.

2. The method of clause 1, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

3. The method of clause 1, wherein the side information comprises atleast one of indication of applying the secondary transform tool, indexof the transform kernels used in the secondary transform process.

4. The method of clause 1, wherein the transform related informationincludes at least one of a transform skip indication indicating to skipforward/inverse transform; side information of a multiple transform set(MTS) tool.

5. The method of clause 4, further comprising that the side informationof the MTS tool includes an index indicating one or more transform typesin a transform set used for the current video block.

6. The method of clause 4, wherein the format rule controls signaling ofthe transform skip indication based on the syntax element.

7. The method of clause 4, wherein the format rule controls signaling ofthe multiple transform set (MTS) index based on the syntax element.

8. The method of clause 7, wherein the multiple transform set (MTS)index is not signaled and inferred to be zero for the current videoblock to which the secondary transform tool is enabled.

9. The method of any of clauses 1 to 8, wherein the syntax element is aLFNST (low frequency non-separable transform) index.

10. The method of any of clauses 1 to 9, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

11. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the coded representation conforms to a format rulespecifying that a syntax element corresponding to side information of asecondary transform tool for the current video block is signaled in thecoded representation before residual coding information, wherein thesecondary transform tool includes applying, during encoding, a forwardsecondary transform to an output of a forward primary transform appliedto a residual of a video block prior to quantization, or applying,during decoding, an inverse secondary transform to an output ofdequantization to the video block before applying an inverse primarytransform.

12. The method of clause 11, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

13. The method of clause 11, wherein the side information comprises atleast one of indication of applying the secondary transform tool, indexof the transform kernels used in the secondary transform process.

14. The method of clause 11, wherein counting of a number of non-zerocoefficients in a partial region and an entire region of the currentvideo block is omitted.

15. The method of clause 11, wherein the syntax element is coded beforea syntax element related to the coding of the residual codinginformation.

16. The method of clause 11, wherein the format rule specifies that thesyntax element is signaled based on signaling of a coded block flag or ausage of a transform selection mode.

17. The method of clause 16, wherein the format rule specifies that thesyntax element is coded after the signaling of the coded block flag orthe usage of the transform selection mode.

18. The method of clause 16, wherein the format rule specifies that thesyntax element is skipped due to the usage of the transform selectionmode that is a transform skip (TS) mode.

19. The method of clause 11, wherein the coded representation excludesthe residual coding information corresponding to coding groups thatalways have zero coefficients.

20. The method of any of clauses 11 to 16, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

21. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the performing of the conversion includes coding aresidual of the current video block according to a rule based oninformation related to the secondary transform tool, and wherein thesecondary transform tool includes applying, during encoding, a forwardsecondary transform to an output of a forward primary transform appliedto a residual of a video block prior to quantization, or applying,during decoding, an inverse secondary transform to an output ofdequantization to the video block before applying an inverse primarytransform.

22. The method of clause 21, wherein the rule specifies to apply araster scanning order or a vertical scanning order instead of a diagonalup-right scanning order.

23. The method of clause 21, wherein the rule specifies to apply acontext modeling based on previously coded information in a templatewhich are the most recent N neighbors in a scanning order.

24. The method of clause 21, wherein the rule specifies to apply acontext modeling based on previously coded information in a templateaccording to a scanned index.

25. The method of clause 21, wherein the rule specifies to applydifferent binarization methods depending on whether the secondarytransform tool is applied to the current video block.

26. The method of clause 21, wherein the rule specifies to skipsignaling of a syntax element due to the application of the secondarytransform tool.

27. The method of clause 26, wherein the rule specifies to skip, for acoding group of the current video block, the signaling of a flagindicating the application of the secondary transform tool.

28. The method of clause 27, wherein the flag is inferred to be 0 or 1.

29. The method of clause 21, wherein the rule specifies to skipsignaling of coefficients and/or sign flags for coordinates due to theapplication of the secondary transform tool.

30. The method of clause 21, wherein the rule specifies to apply, to acoding group of the current video block to which the LFNST tool isapplied, a modified context modeling different from that applied toother coding groups.

31. The method of any of clauses 21 to 30, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

32. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the performing of the conversion includes applying,to one or more portions of the current video block, an arithmetic codingusing different context modeling methods according to a rule.

33. The method of clause 32, wherein the one or more portions include afirst portion including first M coding groups of the current video blockaccording to a scanning order and a second portion including remainingcoding groups of the current video block, whereby M is an integer.

34. The method of clause 33, wherein M is 1 or 2.

35. The method of clause 32, wherein the one or more portions include asub-region of the current video block including one or more codingblocks to which a low frequency non-separable transform (LFNST) tool isapplied and another sub-region of the current video block including oneor more coding blocks to which the LFNST is not applied.

36. The method of clause 32, wherein the rule specifies to disable usageof previously coded information in a context modeling method for a firstportion of the current video block but enable the usage for a secondportion of the current video block.

37. The method of clause 32, wherein the rule specifies, for decoding ofa first coding group of the current video block, to disallow informationof remaining one or more coding groups of the current video block.

38. The method of clause 37, wherein the rule specifies, for coding aflag corresponding to a first coding group, not to consider a value of asecond coding group and/or a third coding group is not considered.

39. The method of clause 37, wherein the rule specifies, for coding acurrent transform coefficient, not to consider information from aneighbor in a context template that is in a different coding group.

40. The method of clause 32, wherein the rule specifies, for decoding ofcoefficients used in a portion to which a low frequency non-separabletransform (LFNST) tool is applied, to disallow information used inanother portion to which the LFNST tool is not applied.

41. The method of clause 32, wherein the rule specifies that theapplying is performed based on whether a low frequency non-separabletransform (LFNST) tool is applied or not and/or a block dimension of thecurrent video block.

42. The method of any of clauses 35, 40 and 41, wherein, using the LFNSTtool, during encoding, a forward secondary transform is applied to anoutput of a forward primary transform applied to the residual of thecurrent video block prior to quantization, or wherein, using the LFNSTtool, during decoding, an inverse secondary transform is applied to anoutput of dequantization to the current video block before applying aninverse primary transform.

43. The method of any of clauses 32 to 42, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

44. The method of any of clauses 1 to 43, wherein at least some blocksof the video are coded in the coded representation using the secondarytransform tool.

45. An apparatus in a video system comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor, cause the processor toimplement the method in any one of clauses 1 to 44.

46. A computer program product stored on a non-transitory computerreadable media, the computer program product including program code forcarrying out the method in any one of clauses 1 to 44.

The fifth set of clauses describe certain features and aspects of thedisclosed techniques in the previous section, for examples, ExampleImplementations 11-16.

1. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe video, wherein the performing of the conversion includesconfiguring, based on a characteristic of the current video block of avideo, a context model for coding a bin or bypass coding the bin of abin string corresponding to an index of a secondary transform tool,wherein the index indicates an applicability of the secondary transformtool and/or a kernel information of the secondary transform tool, andwherein the secondary transform tool includes applying, during encoding,a forward secondary transform to an output of a forward primarytransform applied to a residual of a video block prior to quantization,or wherein the secondary transform tool includes applying, duringdecoding, an inverse secondary transform to an output of dequantizationto the video block before applying an inverse primary transform.

2. The method of clause 1, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool.

3. The method of clause 1, wherein the context model allows a first binand/or second bin to be coded with only one context or bypass coded.

4. The method of clause 1, wherein the characteristic is an enablementof explicit or implicit multiple transform selection (MTS).

5. The method of clause 4, wherein, in a case that the explicit multipletransform selection is enabled, a context is selected based on a type ofan intra prediction mode applied to the current video block, the contextbeing selected for another block using the type of the intra predictionmode.

6. The method of clause 5, wherein the context is selected based on adimension of the current video block.

7. The method of clause 4, wherein transform matrix basis is usedinstead of checking a transform index coded for the explicit multipletransform selection (MTS).

8. The method of clause 1, wherein the characteristic is an enablementof a cross-component linear model (CCLM) coding mode that uses a linearmode to derive prediction values of a chroma component of the currentvideo block.

9. The method of clause 1, wherein an enablement of a cross-componentlinear model (CCLM) coding mode that uses a linear mode to deriveprediction values of a chroma component of the current video blockdetermines an enablement or a selection of the context model for codingthe index of the secondary transform tool.

10. The method of clause 1, wherein an enablement or a selection of thecontext model for coding the index of the secondary transform tooldepends on whether a chroma block of the current video block is codedwith a DM mode in which the chroma block inherits a same intraprediction coding mode of a corresponding luma block.

11. The method of clause 1, wherein the characteristic is a size of thecurrent video block.

12. The method of clause 1, wherein the characteristic is a splittingdepth of a partitioning process applied to the current video block.

13. The method of clause 12, wherein the partitioning process is aquadtree (QT) partitioning process, a binary tree (BT) partitioningprocess or a ternary tree (TT) partitioning process.

14. The method of clause 1, wherein the characteristic is a color formator a color component of the current video block.

15. The method of clause 1, wherein the characteristic excludes an intraprediction mode of the current video block and/or an index of a multipletransform selection (MTS) process.

16. The method of any of clauses 1 to 15, wherein the performing of theconversion includes generating the coded representation from the videoor generating the video from the coded representation.

17. An apparatus in a video system comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor, cause the processor toimplement the method in any one of clauses 1 to 16.

18. A computer program product stored on a non-transitory computerreadable media, the computer program product including program code forcarrying out the method in any one of clauses 1 to 16.

The sixth set of clauses describe certain features and aspects of thedisclosed techniques in the previous section, for examples, ExampleImplementations 17 and 18.

1. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe current video block, wherein the performing of the conversionincludes determining, based on a dimension of the current video block,whether a syntax element is included in the coded representation,wherein the syntax element corresponds to side information of asecondary transform tool which comprises at least one of indication ofapplying the secondary transform and an index of the transform kernelsused in a secondary transform process, and wherein, using the secondarytransform, an inverse secondary transform is used for decoding the codedrepresentation and applied to an output of dequantization of the currentvideo block before applying an inverse primary transform.

2. A video processing method, comprising: performing a conversionbetween a current video block of a video and a coded representation ofthe current video block, wherein the performing of the conversionincludes determining, based on a dimension of the current video block,whether a syntax element is included in the coded representation of thecurrent video block, wherein the syntax element corresponds to sideinformation of a secondary transform which comprises at least one ofindication of applying the secondary transform and an index of thetransform kernels used in a secondary transform process, and wherein,using the secondary transform, a forward secondary transform that isused for encoding the current video block and applied to an output of aprimary transform of the current video block before applyingquantization process.

3. The method of clause 1 or 2, wherein the secondary transformcorresponds to a low frequency non-separable transform (LFNST) tool.

4. The method of any of clauses 1 to 3, wherein the dimension of thecurrent video block is a height (M) or a width (N) of the current videoblock.

5. The method of any of clauses 1, 3, and 4, wherein the syntax elementis not included in the coded representation and the inverse secondarytransform is not applied in a case that (i) M=8 and N=4 or (ii) M=4 andN=8.

6. The method of any clause 1, 3, and 4, wherein the syntax elementrelated to the inverse secondary transform is skipped in a case that theinverse secondary transform is not applied.

7. The method of any of clauses 1 to 3, wherein the syntax elementincludes one or more coded flags of one or more coding groups of thecurrent video block.

8. The method of clause 7, wherein the inverse secondary transform isnot applied in a case that a coded flag of a top-left coding group iszero.

9. The method of clause 8, wherein the current video block has a sizethat is unequal to 4×N or N×4, whereby N is an integer greater than 8.

10. The method of clause 7, wherein the inverse secondary transform isnot applied in a case that coded flags of a first and a second codinggroups according to a scanning order of the current video block arezero.

11. The method of clause 10, wherein the current video block has a sizethat is equal to 4×N or N×4, whereby N is an integer greater than 8.

12. The method of any of clauses 1 to 11, wherein the performing of theconversion includes generating the video from the coded representationor generating the coded representation from the video.

13. The method of any of clauses 1 to 12, wherein at least some blocksof the video are coded in the coded representation using the secondarytransform tool.

14. An apparatus in a video system comprising a processor and anon-transitory memory with instructions thereon, wherein theinstructions upon execution by the processor, cause the processor toimplement the method in any one of clauses 1 to 13.

15. A computer program product stored on a non-transitory computerreadable media, the computer program product including program code forcarrying out the method in any one of clauses 1 to 13.

From the foregoing, it will be appreciated that specific embodiments ofthe presently disclosed technology have been described herein forpurposes of illustration, but that various modifications may be madewithout deviating from the scope of the invention. Accordingly, thepresently disclosed technology is not limited except as by the appendedclaims.

Implementations of the subject matter and the functional operationsdescribed in this patent document can be implemented in various systems,digital electronic circuitry, or in computer software, firmware, orhardware, including the structures disclosed in this specification andtheir structural equivalents, or in combinations of one or more of them.Implementations of the subject matter described in this specificationcan be implemented as one or more computer program products, i.e., oneor more modules of computer program instructions encoded on a tangibleand non-transitory computer readable medium for execution by, or tocontrol the operation of, data processing apparatus. The computerreadable medium can be a machine-readable storage device, amachine-readable storage substrate, a memory device, a composition ofmatter effecting a machine-readable propagated signal, or a combinationof one or more of them. The term “data processing unit” or “dataprocessing apparatus” encompasses all apparatus, devices, and machinesfor processing data, including by way of example a programmableprocessor, a computer, or multiple processors or computers. Theapparatus can include, in addition to hardware, code that creates anexecution environment for the computer program in question, e.g., codethat constitutes processor firmware, a protocol stack, a databasemanagement system, an operating system, or a combination of one or moreof them.

A computer program (also known as a program, software, softwareapplication, script, or code) can be written in any form of programminglanguage, including compiled or interpreted languages, and it can bedeployed in any form, including as a stand-alone program or as a module,component, subroutine, or other unit suitable for use in a computingenvironment. A computer program does not necessarily correspond to afile in a file system. A program can be stored in a portion of a filethat holds other programs or data (e.g., one or more scripts stored in amarkup language document), in a single file dedicated to the program inquestion, or in multiple coordinated files (e.g., files that store oneor more modules, sub programs, or portions of code). A computer programcan be deployed to be executed on one computer or on multiple computersthat are located at one site or distributed across multiple sites andinterconnected by a communication network.

The processes and logic flows described in this specification can beperformed by one or more programmable processors executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application specific integrated circuit).

Processors suitable for the execution of a computer program include, byway of example, both general and special purpose microprocessors, andany one or more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read only memory ora random access memory or both. The essential elements of a computer area processor for performing instructions and one or more memory devicesfor storing instructions and data. Generally, a computer will alsoinclude, or be operatively coupled to receive data from or transfer datato, or both, one or more mass storage devices for storing data, e.g.,magnetic, magneto optical disks, or optical disks. However, a computerneed not have such devices. Computer readable media suitable for storingcomputer program instructions and data include all forms of nonvolatilememory, media and memory devices, including by way of examplesemiconductor memory devices, e.g., EPROM, EEPROM, and flash memorydevices. The processor and the memory can be supplemented by, orincorporated in, special purpose logic circuitry.

It is intended that the specification, together with the drawings, beconsidered exemplary only, where exemplary means an example. As usedherein, the use of “or” is intended to include “and/or”, unless thecontext clearly indicates otherwise.

While this patent document contains many specifics, these should not beconstrued as limitations on the scope of any invention or of what may beclaimed, but rather as descriptions of features that may be specific toparticular embodiments of particular inventions. Certain features thatare described in this patent document in the context of separateembodiments can also be implemented in combination in a singleembodiment. Conversely, various features that are described in thecontext of a single embodiment can also be implemented in multipleembodiments separately or in any suitable subcombination. Moreover,although features may be described above as acting in certaincombinations and even initially claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claimed combination may be directed to asubcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. Moreover, the separation of various system components in theembodiments described in this patent document should not be understoodas requiring such separation in all embodiments.

Only a few implementations and examples are described and otherimplementations, enhancements and variations can be made based on whatis described and illustrated in this patent document.

What is claimed is:
 1. A video processing method, comprising: performinga conversion between a current video block of a video and bitstream ofthe video, wherein the bitstream conforms to a format rule specifyingthat a first syntax element corresponding to side information of a firsttransform tool for the current video block is present in the bitstreambased on a second syntax element corresponding to side information of asecondary transform tool related information, wherein the secondarytransform tool includes applying, during encoding, a forward secondarytransform to an output of a forward primary transform applied to aresidual of a video block prior to quantization, or applying, duringdecoding, an inverse secondary transform to an output of dequantizationof the video block before applying an inverse primary transform.
 2. Themethod of claim 1, wherein the first syntax element comprises at leastone of indication of applying the first transform tool, index of thetransform kernels used in the primary transform process.
 3. The methodof claim 1, wherein the second syntax element comprises at least one ofindication of applying the secondary transform tool, index of thetransform kernels used in the secondary transform tool.
 4. The method ofclaim 3, wherein in response to the second syntax element indicating thesecondary transform tool is enabled, the first syntax element is notpresent in the bitstream and inferred to be zero for the current videoblock.
 5. The method of claim 4, wherein the first transform tool is notapplied.
 6. The method of claim 1, wherein the second syntax element iscontext coded.
 7. The method of claim 6, wherein contexts used forcoding the second syntax element is independent of the first syntaxelement.
 8. The method of claim 6, wherein which context used to codethe second syntax element is based on a color component of the currentvideo block.
 9. The method of claim 6, wherein which context used tocode the second syntax element is further based on a splitting schemefor the current video block.
 10. The method of claim 6, wherein only onecontext is used for coding the second bin of the second syntax element.11. The method of claim 1, wherein the secondary transform toolcorresponds to a low frequency non-separable transform (LFNST) tool. 12.The method of claim 1, wherein the conversion includes encoding thecurrent video block into the bitstream.
 13. The method of claim 1,wherein the conversion includes decoding the current video block fromthe bitstream.
 14. An apparatus for processing video data comprising aprocessor and a non-transitory memory with instructions thereon, whereinthe instructions upon execution by the processor, cause the processorto: perform a conversion between a current video block of a video andbitstream of the video, wherein the bitstream conforms to a format rulespecifying that a first syntax element corresponding to side informationof a first transform tool for the current video block is present in thebitstream based on a second syntax element corresponding to sideinformation of a secondary transform tool related information, whereinthe secondary transform tool includes applying, during encoding, aforward secondary transform to an output of a forward primary transformapplied to a residual of a video block prior to quantization, orapplying, during decoding, an inverse secondary transform to an outputof dequantization of the video block before applying an inverse primarytransform.
 15. The apparatus of claim 14, wherein the first syntaxelement comprises at least one of indication of applying the firsttransform tool, index of the transform kernels used in the primarytransform process.
 16. The apparatus of claim 15, wherein the secondsyntax element comprises at least one of indication of applying thesecondary transform tool, index of the transform kernels used in thesecondary transform tool.
 17. The apparatus of claim 14, wherein inresponse to the second syntax element indicating the secondary transformtool is enabled, the first syntax element is not present in thebitstream and inferred to be zero for the current video block.
 18. Theapparatus of claim 14, wherein the first transform tool is not applied.19. A non-transitory computer-readable storage medium storinginstructions that cause a processor to: perform a conversion between acurrent video block of a video and bitstream of the video, wherein thebitstream conforms to a format rule specifying that a first syntaxelement corresponding to side information of a first transform tool forthe current video block is present in the bitstream based on a secondsyntax element corresponding to side information of a secondarytransform tool related information, wherein the secondary transform toolincludes applying, during encoding, a forward secondary transform to anoutput of a forward primary transform applied to a residual of a videoblock prior to quantization, or applying, during decoding, an inversesecondary transform to an output of dequantization of the video blockbefore applying an inverse primary transform.
 20. A non-transitorycomputer-readable recording medium storing a bitstream of a video whichis generated by a method performed by a video processing apparatus,wherein the method comprises: generating the bitstream for a currentvideo block of the video, wherein the bitstream conforms to a formatrule specifying that a first syntax element corresponding to sideinformation of a first transform tool for the current video block ispresent in the bitstream based on a second syntax element correspondingto side information of a secondary transform tool related information,wherein the secondary transform tool includes applying, during encoding,a forward secondary transform to an output of a forward primarytransform applied to a residual of a video block prior to quantization,or applying, during decoding, an inverse secondary transform to anoutput of dequantization of the video block before applying an inverseprimary transform.